start working on pytex builder
This commit is contained in:
parent
6bef2a82e6
commit
f2fc8a832d
1 changed files with 42 additions and 11 deletions
|
@ -1,7 +1,10 @@
|
|||
from typing import Optional
|
||||
from pathlib import Path
|
||||
|
||||
from PyTeX.build.build import BuildDirSpecification
|
||||
from PyTeX.build.enums import PyTeXRootDirType
|
||||
from PyTeX.format.formatting_config import FormattingConfig
|
||||
from ...logger import logger
|
||||
|
||||
|
||||
class PyTeXBuilder:
|
||||
|
@ -9,21 +12,49 @@ class PyTeXBuilder:
|
|||
self,
|
||||
build_dir_spec: BuildDirSpecification
|
||||
):
|
||||
self._build_spec: BuildDirSpecification = build_dir_spec
|
||||
|
||||
self._default_formatting_config: Optional[FormattingConfig] = None
|
||||
self._build_target_type: Optional[PyTeXRootDirType] = None
|
||||
|
||||
self._recursive: bool = True
|
||||
self._overwrite_existing_files: bool = False
|
||||
self._clean_old_files: True
|
||||
|
||||
self._allow_dirty: bool = False
|
||||
|
||||
def build_sources(self):
|
||||
def build_tex_sources(self):
|
||||
self._build_target_type = PyTeXRootDirType.TEX_SOURCE
|
||||
pass
|
||||
|
||||
def build_documentation(self):
|
||||
self._build_target_type = PyTeXRootDirType.DOC
|
||||
pass
|
||||
|
||||
def build_tex(self):
|
||||
pass
|
||||
def build_tex_files(self):
|
||||
self._build_target_type = PyTeXRootDirType.BUILD
|
||||
pass
|
||||
|
||||
def build(self):
|
||||
if self._build_target_type is None:
|
||||
raise NotImplementedError
|
||||
self._build()
|
||||
|
||||
@property
|
||||
def target_root(self) -> Path:
|
||||
return {
|
||||
PyTeXRootDirType.BUILD: self._build_spec.build_root,
|
||||
PyTeXRootDirType.DOC: self._build_spec.doc_root,
|
||||
PyTeXRootDirType.TEX_SOURCE: self._build_spec.tex_source_root,
|
||||
}[self._build_target_type]
|
||||
|
||||
@property
|
||||
def source_root(self) -> Path:
|
||||
return {
|
||||
PyTeXRootDirType.BUILD: self._build_spec.tex_source_root,
|
||||
PyTeXRootDirType.DOC: self._build_spec.tex_source_root,
|
||||
PyTeXRootDirType.TEX_SOURCE: self._build_spec.pytex_source_root,
|
||||
}[self._build_target_type]
|
||||
|
||||
def get_git_version_info(self):
|
||||
pass
|
||||
|
||||
def parse_config_file(self):
|
||||
pass
|
||||
|
||||
def _build(self):
|
||||
logger.info("Starting build")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue