use correct VersionInfo
This commit is contained in:
parent
3571d409f0
commit
4aaec9fc3d
1 changed files with 17 additions and 15 deletions
|
@ -5,7 +5,7 @@ from .enums import PyTeXRootDirType
|
||||||
from .pytex_config import PyTeXConfig
|
from .pytex_config import PyTeXConfig
|
||||||
from ...logger import logger
|
from ...logger import logger
|
||||||
from .constants import *
|
from .constants import *
|
||||||
from ..versioning.version_info.version_info import FileVersionInfo
|
from ..versioning.version_info.version_info import VersionInfo
|
||||||
from .pytex_file import PyTeXSourceFile
|
from .pytex_file import PyTeXSourceFile
|
||||||
from .relative_path import RelativePath
|
from .relative_path import RelativePath
|
||||||
|
|
||||||
|
@ -26,36 +26,36 @@ class PyTeXBuilder:
|
||||||
self._root_dir = root_dir
|
self._root_dir = root_dir
|
||||||
|
|
||||||
# Non-public attributes
|
# Non-public attributes
|
||||||
self._version_info: Optional[FileVersionInfo] = None
|
self._version_info: Optional[VersionInfo] = None
|
||||||
self._pytex_files: Optional[List[PyTeXSourceFile]] = None
|
self._pytex_files: Optional[List[PyTeXSourceFile]] = None
|
||||||
|
|
||||||
def build_tex_sources(self):
|
def build_tex_sources(self) -> bool:
|
||||||
self._build_target_type = PyTeXRootDirType.TEX_SOURCE
|
self._build_target_type = PyTeXRootDirType.TEX_SOURCE
|
||||||
self._build()
|
return self._build()
|
||||||
|
|
||||||
def build_documentation(self):
|
def build_documentation(self) -> bool:
|
||||||
self._build_target_type = PyTeXRootDirType.DOC
|
self._build_target_type = PyTeXRootDirType.DOC
|
||||||
self._build()
|
return self._build()
|
||||||
|
|
||||||
def build_tex_files(self):
|
def build_tex_files(self) -> bool:
|
||||||
self._build_target_type = PyTeXRootDirType.BUILD
|
self._build_target_type = PyTeXRootDirType.BUILD
|
||||||
self._build()
|
return self._build()
|
||||||
|
|
||||||
def build(self):
|
def build(self) -> bool:
|
||||||
if self._build_target_type is None:
|
if self._build_target_type is None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
self._build()
|
return self._build()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def version_info(self):
|
def version_info(self) -> VersionInfo:
|
||||||
if self._version_info is None:
|
if self._version_info is None:
|
||||||
version_info_file = self.target_root / VERSION_INFO_FILE
|
version_info_file = self.target_root / VERSION_INFO_FILE
|
||||||
if version_info_file.exists():
|
if version_info_file.exists():
|
||||||
self._version_info = FileVersionInfo.from_json(
|
self._version_info = VersionInfo.from_json(
|
||||||
self.target_root / VERSION_INFO_FILE
|
self.target_root / VERSION_INFO_FILE
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self._version_info = FileVersionInfo()
|
self._version_info = VersionInfo()
|
||||||
return self._version_info
|
return self._version_info
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -122,13 +122,15 @@ class PyTeXBuilder:
|
||||||
relative_path=RelativePath(
|
relative_path=RelativePath(
|
||||||
self.source_root,
|
self.source_root,
|
||||||
file
|
file
|
||||||
)
|
),
|
||||||
|
default_config=self.pytex_config.default_formatting_config
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: give pytex source file some additional building information
|
# TODO: give pytex source file some additional building information
|
||||||
|
|
||||||
def _build(self):
|
def _build(self) -> bool:
|
||||||
logger.info("Starting build")
|
logger.info("Starting build")
|
||||||
self.load_pytex_files()
|
self.load_pytex_files()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue