fix bugs with reading config

This commit is contained in:
Maximilian Keßler 2022-02-18 22:42:09 +01:00
parent cdaf38c4d6
commit df423f586f
4 changed files with 10 additions and 6 deletions

View file

@ -283,7 +283,7 @@ class PyTeXBuilder:
rel_path.name rel_path.name
] = config ] = config
for filename in source_file.output_files: for filename in source_file.output_files:
logger.verbose(f"[Built] {filename}") logger.verbose(f"[Built] {self.target_root / filename.relative_path}")
for output_file in source_file.output_files: for output_file in source_file.output_files:
# TODO: handle this new config file # TODO: handle this new config file
# TODO: handle git stuff / meta info stuff # TODO: handle git stuff / meta info stuff

View file

@ -3,7 +3,7 @@ from typing import Optional, Dict, List
from PyTeX.build.build import BuildDirConfig from PyTeX.build.build import BuildDirConfig
from PyTeX.format.formatting_config import FormattingConfig from PyTeX.format.formatting_config import FormattingConfig
from .constants import * from .constants import *
from ...format.config import Config from ...format.config import Config, clean_dict
class PyTeXConfig(Config): class PyTeXConfig(Config):
@ -45,7 +45,8 @@ class PyTeXConfig(Config):
filled_content = self._fill_keys(content) filled_content = self._fill_keys(content)
build = filled_content[YAML_BUILD] build = filled_content[YAML_BUILD]
self._build_dir_specification = BuildDirConfig.from_json(build[YAML_DIRS]) cleaned_dirs = clean_dict(build[YAML_DIRS])
self._build_dir_specification = BuildDirConfig.from_json(cleaned_dirs) if cleaned_dirs else None
self._recursive = build[YAML_RECURSIVE] self._recursive = build[YAML_RECURSIVE]
self._clean_old_files = build[YAML_CLEAN_OLD_FILES] self._clean_old_files = build[YAML_CLEAN_OLD_FILES]
self._overwrite_existing_files = build[YAML_OVERWRITE_FILES] self._overwrite_existing_files = build[YAML_OVERWRITE_FILES]

View file

@ -16,7 +16,7 @@ class DTXFormatter(TexFormatter):
def future_config(self) -> List[Tuple[str, FormattingConfig]]: def future_config(self) -> List[Tuple[str, FormattingConfig]]:
config = FormattingConfig() config = FormattingConfig()
config.tex_out_type = self.config.tex_out_type config.tex_out_type = self.config.tex_out_type
return [(self.name + '.dtx', config)] return [(self.name, config)]
@property @property
def output_files(self) -> List[str]: def output_files(self) -> List[str]:

View file

@ -1,5 +1,6 @@
import signal import signal
import shutil import shutil
import sys
from pathlib import Path from pathlib import Path
from PyTeX.build.build import PyTeXBuilder from PyTeX.build.build import PyTeXBuilder
from PyTeX.build.build.pytex_config import PyTeXConfig from PyTeX.build.build.pytex_config import PyTeXConfig
@ -23,9 +24,11 @@ conf_path = Path('.pytexrc')
builder = PyTeXBuilder(conf_path) builder = PyTeXBuilder(conf_path)
builder.build_tex_sources()
# builder.build_tex_files() if 'source' in sys.argv:
builder.build_tex_sources()
if 'tex' in sys.argv:
builder.build_tex_files()
pass pass