write relative file names in build info

This commit is contained in:
Maximilian Keßler 2022-01-13 15:33:16 +01:00
parent 026e3a6cb3
commit 4e7ea6fd14
2 changed files with 8 additions and 4 deletions

View file

@ -98,7 +98,8 @@ def build(
sources_to_build.append( sources_to_build.append(
TexFileToFormat( TexFileToFormat(
src_path=file, src_path=file,
build_dir=output_dir / file.parent.relative_to(input_dir), build_root=output_dir,
src_root=src_dir,
latex_name=latex_name, latex_name=latex_name,
current_build_info=current_build_info, current_build_info=current_build_info,
last_build_info=last_build_info_for_this_file, last_build_info=last_build_info_for_this_file,

View file

@ -13,7 +13,8 @@ class TexFileToFormat:
def __init__( def __init__(
self, self,
src_path: Path, src_path: Path,
build_dir: Path, build_root: Path,
src_root: Path,
latex_name: str, latex_name: str,
current_build_info: BuildInfo, current_build_info: BuildInfo,
last_build_info: Optional[List[dict]], last_build_info: Optional[List[dict]],
@ -21,7 +22,9 @@ class TexFileToFormat:
overwrite_existing_files: bool = False, overwrite_existing_files: bool = False,
build_all: bool = False): build_all: bool = False):
self.src_path = src_path self.src_path = src_path
self.build_path = build_dir self.build_root = build_root
self.src_root = src_root
self.build_path = build_root / src_path.parent.relative_to(src_root)
self.latex_name = latex_name # Still an identifier on how to name the package when being formatted self.latex_name = latex_name # Still an identifier on how to name the package when being formatted
self.current_build_info = current_build_info self.current_build_info = current_build_info
self.last_build_info_all = last_build_info self.last_build_info_all = last_build_info
@ -129,7 +132,7 @@ class TexFileToFormat:
build_infos = [] build_infos = []
for written_file in written_files: for written_file in written_files:
info = { info = {
'name': written_file, 'name': str(self.src_path.parent.relative_to(self.src_root)) + "/" + written_file,
'source file': self.src_path.name, 'source file': self.src_path.name,
'build time': self.current_build_info.build_time, 'build time': self.current_build_info.build_time,
'source version': self.current_build_info.packages_version, 'source version': self.current_build_info.packages_version,