pytex/PyTeX/build/build/build_dir_spec.py

53 lines
1.4 KiB
Python

from pathlib import Path, PurePath
from typing import Optional
from ..enums import PyTeXRootDirType
class BuildDirSpecification:
def __init__(
self,
source_root: Optional[Path] = None,
build_root: Optional[Path] = None,
doc_root: Optional[Path] = None,
tex_root: Optional[Path] = None,
wrapper_dir: Optional[PurePath] = None
):
self._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
@property
def doc_root(self) -> Path:
return self._doc_root
@property
def source_root(self) -> Path:
return self._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]
@property
def wrapper_dir(self) -> PurePath:
raise NotImplementedError