add root dir to pytex builder
This commit is contained in:
parent
94b5f28567
commit
e68fcb6550
2 changed files with 13 additions and 8 deletions
|
@ -1,7 +1,6 @@
|
|||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from typing import Optional, Union
|
||||
|
||||
from PyTeX.build.build import BuildDirConfig
|
||||
from PyTeX.build.enums import PyTeXRootDirType
|
||||
from .pytex_config import PyTeXConfig
|
||||
from ...logger import logger
|
||||
|
@ -10,11 +9,18 @@ from ...logger import logger
|
|||
class PyTeXBuilder:
|
||||
def __init__(
|
||||
self,
|
||||
build_dir_spec: BuildDirConfig
|
||||
pytex_config: Optional[Union[PyTeXConfig, Path, str]] = None,
|
||||
root_dir: Optional[Path] = None
|
||||
):
|
||||
|
||||
self._build_target_type: Optional[PyTeXRootDirType] = None
|
||||
self._pytex_config: Optional[PyTeXConfig] = None
|
||||
if isinstance(pytex_config, Path) or isinstance(pytex_config, str):
|
||||
config_file = Path(pytex_config)
|
||||
self._pytex_config = PyTeXConfig.from_yaml(config_file)
|
||||
self._root_dir: Optional[Path] = config_file.parent
|
||||
else:
|
||||
self._pytex_config: Optional[PyTeXConfig] = pytex_config
|
||||
self._root_dir: Optional[Path] = root_dir
|
||||
|
||||
def build_tex_sources(self):
|
||||
self._build_target_type = PyTeXRootDirType.TEX_SOURCE
|
||||
|
|
7
main.py
7
main.py
|
@ -14,10 +14,6 @@ spec = BuildDirConfig(
|
|||
wrapper_dir=Path('mkessler')
|
||||
)
|
||||
|
||||
builder = PyTeXBuilder(
|
||||
build_dir_spec=spec
|
||||
)
|
||||
|
||||
p: RelativePath = RelativePath(Path('src'), 'src/hello/bla')
|
||||
|
||||
rel = p.relative_path
|
||||
|
@ -52,4 +48,7 @@ conf_path = Path('/home/maximilian/git/LatexPackages/.pytexrc')
|
|||
|
||||
pytex_config = PyTeXConfig.from_yaml(conf_path)
|
||||
|
||||
|
||||
builder = PyTeXBuilder(conf_path)
|
||||
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue