Skip to content

Commit

Permalink
Disregard indirect links we use from enable scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Oct 2, 2024
1 parent c8de30a commit 5ff07fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions komodo/symlink/sanity_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ def read_link_structure(path):

bleeding_timestamp_pattern = r"bleeding-\d{8}-\d{4}-"
bleeding_deleteme_pattern = r"bleeding-.*\.deleteme"
dangling_root_folders = ["bleeding-py311-rhel8", "bleeding-py38-rhel7", "bleeding-py38-rhel8"]

for file_path in list_of_files:
file_name = os.path.basename(file_path)

if re.match(bleeding_timestamp_pattern, file_name) or re.match(bleeding_deleteme_pattern, file_name):
continue

if os.path.islink(file_path):
if not any([
re.match(bleeding_timestamp_pattern, file_name),
re.match(bleeding_deleteme_pattern, file_name),
file_name in dangling_root_folders,
not os.path.islink(file_path)
]):
link_structure["links"][file_name] = os.path.basename(
os.readlink(file_path),
)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_link_io_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def test_read_folder_structure(tmpdir):
os.symlink("2012.01", "stable")
os.symlink("2012.01.rc2", "testing")
os.symlink("nowhere", "bleeding-20242012-2313-py311")
os.symlink("nowhere", "bleeding-20242012-2245-py38")
os.symlink("nowhere", "bleeding-something.deleteme")
os.symlink("bleeding-20242012-2313-py38", "bleeding-py38-rhel7")
os.symlink("bleeding-20242012-2313-py38", "bleeding-py38-rhel8")
os.symlink("bleeding-20242012-2313-py311", "bleeding-py311-rhel8")

expected_result = {
"root_folder": tmpdir,
Expand Down

0 comments on commit 5ff07fe

Please sign in to comment.