allow files from a git repo to exist in build repo without throwing an error

This commit is contained in:
Maximilian Keßler 2022-01-30 21:45:44 +01:00
parent ed6494826f
commit 75428387f6

View file

@ -28,7 +28,7 @@ def build(
build_all: bool = False, # output control / versioning build_all: bool = False, # output control / versioning
write_build_information: bool = True, # meta write_build_information: bool = True, # meta
clean_old_files: bool = False clean_old_files: bool = False
): ):
pytex_msg('Getting git repository information...') pytex_msg('Getting git repository information...')
if extra_header: if extra_header:
if extra_header.exists(): if extra_header.exists():
@ -95,8 +95,9 @@ def build(
sources_to_build = [] sources_to_build = []
for file in files: for file in files:
if last_build_info: if last_build_info:
last_build_info_for_this_file =\ last_build_info_for_this_file = \
list(filter(lambda i: i['source file'] == str(file.relative_to(src_dir)), last_build_info['tex_sources'])) list(filter(lambda i: i['source file'] == str(file.relative_to(src_dir)),
last_build_info['tex_sources']))
else: else:
last_build_info_for_this_file = [] last_build_info_for_this_file = []
sources_to_build.append( sources_to_build.append(
@ -147,6 +148,7 @@ def build(
file.unlink() file.unlink()
elif not str(file.relative_to(output_dir)) in built_files: 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': if not file.is_dir() and not str(file.relative_to(output_dir)) == 'build_info.json':
if '.git' not in str(file):
# PyTeX does not at all know something about this file # PyTeX does not at all know something about this file
raise UnknownFileInBuildDirectoryError(file.relative_to(output_dir)) raise UnknownFileInBuildDirectoryError(file.relative_to(output_dir))