Skip to content

Commit

Permalink
Path.is_related_to is only in python 3.9 so changing to related_to me…
Browse files Browse the repository at this point in the history
…thod to be compatible with older python versions
  • Loading branch information
Glenn Snyder committed Mar 5, 2021
1 parent 0a54c40 commit 6d99340
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bd-splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ def in_exclude_list(abs_path):
# TODO: Need to pop folders from the exclude list as we deal with them. How?
if subdir not in scan_dirs and subdir not in exclude_folders:
logging.debug(f"adding subdir {subdir} to list of directories to scan")
exclude_folders_under_subdir = [f for f in exclude_folders if f.is_relative_to(subdir)]
exclude_folders_under_subdir = list()
for f in exclude_folders:
try:
f.relative_to(subdir)
except ValueError:
logging.debug(f"folder {f} is not a sub-dir of {subdir}")
continue
else:
logging.debug(f"folder {f} is a sub-dir of {subdir} so will exclude it from detect scan of {subdir}")
exclude_folders_under_subdir.append(f)
# exclude_folders_under_subdir = [f for f in exclude_folders if f.is_relative_to(subdir)]
logging.debug(f"excluding dirs {exclude_folders_under_subdir} from subdir {subdir} analysis")
scan_dirs[subdir] = {"exclude_folders": exclude_folders_under_subdir}
exclude_folders -= set(exclude_folders_under_subdir)
Expand Down

0 comments on commit 6d99340

Please sign in to comment.