From 5ff07fe0131968f4456cb0b98f6d4807bafc9a37 Mon Sep 17 00:00:00 2001 From: Andreas Eknes Lie Date: Wed, 2 Oct 2024 14:18:44 +0200 Subject: [PATCH] Disregard indirect links we use from enable scripts --- komodo/symlink/sanity_check.py | 11 +++++++---- tests/test_link_io_structure.py | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/komodo/symlink/sanity_check.py b/komodo/symlink/sanity_check.py index f10056ee..0958b8a3 100644 --- a/komodo/symlink/sanity_check.py +++ b/komodo/symlink/sanity_check.py @@ -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), ) diff --git a/tests/test_link_io_structure.py b/tests/test_link_io_structure.py index 2df8e6bb..40edd59a 100644 --- a/tests/test_link_io_structure.py +++ b/tests/test_link_io_structure.py @@ -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,