diff options
Diffstat (limited to 'scripts/incremental_build/cuj_catalog.py')
-rw-r--r-- | scripts/incremental_build/cuj_catalog.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/incremental_build/cuj_catalog.py b/scripts/incremental_build/cuj_catalog.py index 6db3c8d8..7d2de238 100644 --- a/scripts/incremental_build/cuj_catalog.py +++ b/scripts/incremental_build/cuj_catalog.py @@ -64,20 +64,15 @@ def verify_symlink_forest_has_only_symlink_leaves(): files except for merged BUILD.bazel files""" top_in_ws = InWorkspace.ws_counterpart(util.get_top_dir()) - def helper(d: Path): - for child in os.scandir(d): - child_path: Path = Path(child.path) - if child_path.name == 'symlink_forest_version' and d == top_in_ws: - continue - if child_path.is_symlink(): + + for root, dirs, files in os.walk(top_in_ws, topdown=True, followlinks=False): + for file in files: + if file == 'symlink_forest_version' and top_in_ws.samefile(root): continue - if child_path.is_file() and child.name != 'BUILD.bazel': - # only "merged" BUILD.bazel files expected - raise AssertionError(f'{child_path} is an unexpected file') - if child_path.is_dir(): - helper(child_path) + f = Path(root).joinpath(file) + if file != 'BUILD.bazel' and not f.is_symlink(): + raise AssertionError(f'{f} unexpected') - helper(top_in_ws) logging.info('VERIFIED Symlink Forest has no real files except BUILD.bazel') |