better root dir management
This commit is contained in:
parent
b00e62c017
commit
0423cb5de8
1 changed files with 11 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue