From 75428387f6cef3e703ca02ae0f7b252d9b1a7c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 30 Jan 2022 21:45:44 +0100 Subject: [PATCH] allow files from a git repo to exist in build repo without throwing an error --- build/build.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/build/build.py b/build/build.py index f24384f..216cd15 100644 --- a/build/build.py +++ b/build/build.py @@ -15,20 +15,20 @@ def build( build_dir: Optional[Path] = None, input_file: Optional[Path] = None, author: Optional[str] = None, - latex_name: str = 'prepend-author', # name handling - recursive: bool = False, # input control - include_timestamp: bool = False, # header - include_pytex_version: bool = False, # header - include_license: bool = False, # header - include_git_version: bool = False, # header - include_pytex_info_text: bool = False, # header + latex_name: str = 'prepend-author', # name handling + recursive: bool = False, # input control + include_timestamp: bool = False, # header + include_pytex_version: bool = False, # header + include_license: bool = False, # header + include_git_version: bool = False, # header + include_pytex_info_text: bool = False, # header extra_header: Optional[Path] = None, - allow_dirty: bool = False, # versioning - overwrite_existing_files: bool = False, # output control - build_all: bool = False, # output control / versioning - write_build_information: bool = True, # meta + allow_dirty: bool = False, # versioning + overwrite_existing_files: bool = False, # output control + build_all: bool = False, # output control / versioning + write_build_information: bool = True, # meta clean_old_files: bool = False - ): +): pytex_msg('Getting git repository information...') if extra_header: if extra_header.exists(): @@ -95,8 +95,9 @@ def build( sources_to_build = [] for file in files: if last_build_info: - last_build_info_for_this_file =\ - list(filter(lambda i: i['source file'] == str(file.relative_to(src_dir)), last_build_info['tex_sources'])) + last_build_info_for_this_file = \ + list(filter(lambda i: i['source file'] == str(file.relative_to(src_dir)), + last_build_info['tex_sources'])) else: last_build_info_for_this_file = [] sources_to_build.append( @@ -147,8 +148,9 @@ def build( file.unlink() elif not str(file.relative_to(output_dir)) in built_files: if not file.is_dir() and not str(file.relative_to(output_dir)) == 'build_info.json': - # PyTeX does not at all know something about this file - raise UnknownFileInBuildDirectoryError(file.relative_to(output_dir)) + if '.git' not in str(file): + # PyTeX does not at all know something about this file + raise UnknownFileInBuildDirectoryError(file.relative_to(output_dir)) if write_build_information: with open(output_dir / 'build_info.json', 'w') as f: