From c8de30ab275b5aa32d3b93f2effa1550c6092c77 Mon Sep 17 00:00:00 2001 From: Andreas Eknes Lie Date: Wed, 2 Oct 2024 13:52:32 +0200 Subject: [PATCH] Disregard bleeding and deleteme in read_link_structure --- komodo/symlink/sanity_check.py | 9 +++++++++ tests/test_link_io_structure.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/komodo/symlink/sanity_check.py b/komodo/symlink/sanity_check.py index 1e510e413..f10056ee6 100644 --- a/komodo/symlink/sanity_check.py +++ b/komodo/symlink/sanity_check.py @@ -3,6 +3,7 @@ import json import os import pprint +import re import sys @@ -32,8 +33,16 @@ def read_link_structure(path): } list_of_files = [os.path.join(path, file_name) for file_name in os.listdir(path)] + + bleeding_timestamp_pattern = r"bleeding-\d{8}-\d{4}-" + bleeding_deleteme_pattern = r"bleeding-.*\.deleteme" + 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): 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 4db5893a9..2df8e6bb2 100644 --- a/tests/test_link_io_structure.py +++ b/tests/test_link_io_structure.py @@ -24,10 +24,13 @@ def test_read_folder_structure(tmpdir): os.mkdir("2012.01.rc2") os.mkdir("bleeding") os.mkdir("2012.01.12") + os.mkdir("nowhere") os.symlink("2012.01.12", "2012.01") os.symlink("2012.01", "stable") os.symlink("2012.01.rc2", "testing") + os.symlink("nowhere", "bleeding-20242012-2313-py311") + os.symlink("nowhere", "bleeding-something.deleteme") expected_result = { "root_folder": tmpdir,