pytex/PyTeX/config/global_config.py

55 lines
1.4 KiB
Python
Raw Normal View History

2022-02-04 21:14:58 +01:00
from pathlib import Path, PurePath
2022-02-04 11:39:15 +01:00
from typing import Optional
2022-02-04 11:46:06 +01:00
from .formatting_config import BasicFormattingConfig
2022-02-04 11:39:15 +01:00
class GlobalPyTeXConfig:
_source_root: Optional[Path] = None
_build_root: Optional[Path] = None
_doc_root: Optional[Path] = None
_tex_root: Optional[Path] = None
2022-02-04 21:14:58 +01:00
_wrapper_dir: Optional[PurePath] = None
2022-02-04 11:39:15 +01:00
2022-02-04 11:46:06 +01:00
_default_formatting_config: Optional[BasicFormattingConfig] = None
2022-02-04 11:39:15 +01:00
_recursive: bool = True
_overwrite_existing_files: bool = False
_clean_old_files: True
_allow_dirty: bool = False
2022-02-04 21:14:58 +01:00
@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
2022-02-04 11:39:15 +01:00
@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
2022-02-04 21:14:58 +01:00
@classmethod
def wrapper_dir(cls) -> PurePath:
return cls._wrapper_dir