From 0423cb5de839b7caba450e32aa6a0eabef6acb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 8 Feb 2022 19:40:41 +0100 Subject: [PATCH] better root dir management --- PyTeX/build/build/builder.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/PyTeX/build/build/builder.py b/PyTeX/build/build/builder.py index e2f0394..70b1993 100644 --- a/PyTeX/build/build/builder.py +++ b/PyTeX/build/build/builder.py @@ -19,10 +19,15 @@ class PyTeXBuilder: self._build_target_type: Optional[PyTeXRootDirType] = 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 + self._pytex_config: Optional[PyTeXConfig] = PyTeXConfig.from_yaml(config_file) else: self._pytex_config = pytex_config + if root_dir is None: + if isinstance(pytex_config, Path): + self._root_dir = pytex_config.parent + else: + self._root_dir: Path = Path('.') # Working directory + else: self._root_dir = root_dir # Non-public attributes @@ -82,10 +87,10 @@ class PyTeXBuilder: } return switcher[self._build_target_type] - def get_git_version_info(self): + def _get_git_version_info(self): pass - def parse_config_file(self): + def _parse_config_file(self): pass @classmethod @@ -109,7 +114,7 @@ class PyTeXBuilder: for extension in self.supported_extensions() ] - def load_pytex_files(self): + def _load_pytex_files(self): self._pytex_files = [] if self.pytex_config.recursive: files = self.source_root.rglob('*') @@ -131,6 +136,6 @@ class PyTeXBuilder: def _build(self) -> bool: logger.info("Starting build") - self.load_pytex_files() + self._load_pytex_files() return True