pytex/PyTeX/config/global_config.py
2022-02-04 21:15:19 +01:00

54 lines
1.4 KiB
Python

from pathlib import Path, PurePath
from typing import Optional
from .formatting_config import BasicFormattingConfig
class GlobalPyTeXConfig:
_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
_default_formatting_config: Optional[BasicFormattingConfig] = None
_recursive: bool = True
_overwrite_existing_files: bool = False
_clean_old_files: True
_allow_dirty: bool = False
@classmethod
def init(
cls,
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
):
cls._source_root = source_root
cls._build_root = build_root
cls._doc_root = doc_root
cls._tex_root = tex_root
cls._wrapper_dir = wrapper_dir
@classmethod
def build_root(cls) -> Path:
return cls._build_root
@classmethod
def doc_root(cls) -> Path:
return cls._doc_root
@classmethod
def source_root(cls) -> Path:
return cls._source_root
@classmethod
def tex_root(cls) -> Path:
return cls._tex_root
@classmethod
def wrapper_dir(cls) -> PurePath:
return cls._wrapper_dir