add pytex config
This commit is contained in:
parent
fd7d49c0a6
commit
d6b9f95efb
2 changed files with 64 additions and 2 deletions
62
PyTeX/build/build/pytex_config.py
Normal file
62
PyTeX/build/build/pytex_config.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from typing import Optional
|
||||
|
||||
from PyTeX.build.build import BuildDirSpecification
|
||||
from PyTeX.format.formatting_config import FormattingConfig
|
||||
|
||||
|
||||
class PyTeXConfig:
|
||||
def __init__(
|
||||
self,
|
||||
build_dir_spec: Optional[BuildDirSpecification] = None
|
||||
):
|
||||
self._build_dir_specification: Optional[BuildDirSpecification] = build_dir_spec
|
||||
|
||||
self._default_formatting_config: Optional[FormattingConfig] = None
|
||||
|
||||
self._recursive: Optional[bool] = None
|
||||
self._overwrite_existing_files: Optional[bool] = None
|
||||
self._clean_old_files: Optional[bool] = None
|
||||
self._allow_dirty: Optional[bool] = None
|
||||
|
||||
@property
|
||||
def build_dir_specification(self):
|
||||
if self._build_dir_specification is None:
|
||||
return BuildDirSpecification()
|
||||
else:
|
||||
return self._build_dir_specification
|
||||
|
||||
@property
|
||||
def recursive(self) -> bool:
|
||||
if self._recursive is None:
|
||||
return True
|
||||
else:
|
||||
return self._recursive
|
||||
|
||||
@property
|
||||
def overwrite_existing_files(self) -> bool:
|
||||
if self._overwrite_existing_files is None:
|
||||
return False
|
||||
else:
|
||||
return self._overwrite_existing_files
|
||||
|
||||
@property
|
||||
def clean_old_files(self) -> bool:
|
||||
if self._clean_old_files is None:
|
||||
return False
|
||||
else:
|
||||
return self._clean_old_files
|
||||
|
||||
@property
|
||||
def allow_dirty(self) -> bool:
|
||||
if self._allow_dirty is None:
|
||||
return False
|
||||
else:
|
||||
return self._allow_dirty
|
||||
|
||||
@property
|
||||
def default_formatting_config(self) -> FormattingConfig:
|
||||
if self._default_formatting_config is None:
|
||||
return FormattingConfig()
|
||||
else:
|
||||
return self._default_formatting_config
|
||||
|
|
@ -27,8 +27,8 @@ class FormattingConfig(Config):
|
|||
self._repo_version: Optional[GitVersionInfo] = None
|
||||
self._repo_info_text: Optional[GenericText] = None
|
||||
|
||||
self._include_drv: Optional[bool] = True
|
||||
self._include_ins: Optional[bool] = True
|
||||
self._include_drv: Optional[bool] = None
|
||||
self._include_ins: Optional[bool] = None
|
||||
self._use_docstrip_guards: Optional[List[str]] = None
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue