From 49286942127a2bf75a66091cd7f70e8514dc283a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 6 Feb 2022 20:38:30 +0100 Subject: [PATCH] make pytex file more flexible --- PyTeX/build/build/build_dir_spec.py | 44 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/PyTeX/build/build/build_dir_spec.py b/PyTeX/build/build/build_dir_spec.py index 7e0090f..9d123d9 100644 --- a/PyTeX/build/build/build_dir_spec.py +++ b/PyTeX/build/build/build_dir_spec.py @@ -1,8 +1,6 @@ from pathlib import Path, PurePath from typing import Optional -from ..enums import PyTeXRootDirType - class BuildDirSpecification: def __init__( @@ -13,41 +11,45 @@ class BuildDirSpecification: tex_root: Optional[Path] = None, wrapper_dir: Optional[PurePath] = None ): - self._source_root: Optional[Path] = source_root + self._pytex_source_root: Optional[Path] = source_root self._build_root: Optional[Path] = build_root self._doc_root: Optional[Path] = doc_root self._tex_root: Optional[Path] = tex_root self._wrapper_dir: Optional[PurePath] = wrapper_dir - self._build_target_dir_type: PyTeXRootDirType = None - @property def build_root(self) -> Path: - return self._build_root + if self._build_root is None: + return Path('build') + else: + return self._build_root @property def doc_root(self) -> Path: - return self._doc_root + if self._doc_root is None: + return Path('build/doc') + else: + return self._doc_root @property - def source_root(self) -> Path: - return self._source_root + def pytex_source_root(self) -> Path: + if self._pytex_source_root is None: + return Path('src') + else: + return self._pytex_source_root @property - def tex_root(self) -> Path: - return self._tex_root - - @property - def target_root(self) -> Path: - return { - PyTeXRootDirType.BUILD: self.build_root, - PyTeXRootDirType.DOC: self.doc_root, - PyTeXRootDirType.TEX_SOURCE: self.tex_root, - PyTeXRootDirType.PYTEX_SOURCE: self.source_root - }[self._build_target_dir_type] + def tex_source_root(self) -> Path: + if self._tex_root is None: + return Path('build/source') + else: + return self._tex_root @property def wrapper_dir(self) -> PurePath: - raise NotImplementedError + if self._wrapper_dir is None: + return Path('') + else: + return self._wrapper_dir