Skip to content

Commit

Permalink
chore: refactor _ignore_files in dependency management to leverage is…
Browse files Browse the repository at this point in the history
…_relative_to

Signed-off-by: SdgJlbl <[email protected]>
  • Loading branch information
SdgJlbl committed Sep 13, 2024
1 parent e442480 commit d4ec8de
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions substrafl/dependency/path_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ def copy_paths(
def _ignore_files(expanded_excluded, dest_dir):
def _ignore_files(path: str, names: List[str]) -> Set[str]:
p = Path(path).resolve()

# Replicate is_relative_to, added in Python 3.9
try:
p.relative_to(dest_dir.resolve())
except ValueError:
return set(name for name in names if p / name in expanded_excluded)
else:
if p.is_relative_to(dest_dir.resolve()):
return set(names)
else:
return set(name for name in names if p / name in expanded_excluded)

return _ignore_files

0 comments on commit d4ec8de

Please sign in to comment.