From 4149e8bc368772958c7ec6a316b0570acf2d649d Mon Sep 17 00:00:00 2001 From: devdanzin <74280297+devdanzin@users.noreply.github.com> Date: Mon, 28 Aug 2023 18:04:48 -0300 Subject: [PATCH] Fix empty path inclusion, add comments. --- src/wily/commands/build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wily/commands/build.py b/src/wily/commands/build.py index 02b5b3b3..4d5a23da 100644 --- a/src/wily/commands/build.py +++ b/src/wily/commands/build.py @@ -134,6 +134,8 @@ def build(config: WilyConfig, archiver: Archiver, operators: List[Operator]) -> # Copy the ir from any unchanged files from the prev revision if not seed: + # File names in result are platform dependent, so we convert + # to Path and back to str. files = {str(pathlib.Path(f)) for f in revision.tracked_files} missing_indices = files - indices # TODO: Check existence of file path. @@ -156,9 +158,13 @@ def build(config: WilyConfig, archiver: Archiver, operators: List[Operator]) -> for deleted in revision.deleted_files: result.pop(deleted, None) + # Add empty path for storing total aggregates + dirs = [""] + # Directory names in result are platform dependent, so we convert + # to Path and back to str. + dirs += [str(pathlib.Path(d)) for d in revision.tracked_dirs if d] # Aggregate metrics across all root paths using the aggregate function in the metric - # Note assumption is that nested dirs are listed after parent.. - dirs = {str(pathlib.Path(d)) for d in revision.tracked_dirs} + # Note assumption is that nested dirs are listed after parent, hence sorting. for root in sorted(dirs): # find all matching entries recursively aggregates = [