From 0cf3e442da2f18e7d3912a54ef6afb202d51b591 Mon Sep 17 00:00:00 2001 From: Zach Wright Date: Tue, 17 Dec 2024 14:27:52 -0500 Subject: [PATCH] KPMP-5665: don't exit, uncomment move code --- scripts/packageChecker/packageChecker.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/packageChecker/packageChecker.py b/scripts/packageChecker/packageChecker.py index 1a6111c7..30f4228a 100644 --- a/scripts/packageChecker/packageChecker.py +++ b/scripts/packageChecker/packageChecker.py @@ -111,7 +111,6 @@ def find_empty_packages(self, move_derived=False): clean_file_name = file_name.replace("[", "").replace("]", "").replace(",", "").replace("'", "") if clean_file_name != 'derived' and 'svs' not in clean_file_name: self.move_file_to_derived(directory, clean_file_name) - # os._exit(0) except: missing_package_list.append(package_id) @@ -142,16 +141,16 @@ def move_file_to_derived(self, package_directory, file_name): file_path = package_directory + "/" + file_name if os.path.isfile(file_path): print(f"Moving file '{file_path}' to '{derived_dir}'.") - # if not os.path.exists(derived_dir): - # os.makedirs(derived_dir) - # - # try: - # shutil.move(file_path, derived_dir) - # print(f"File '{file_path}' moved to '{derived_dir}' successfully.") - # except FileNotFoundError: - # print(f"Error: File '{source_file}' not found.") - # except Exception as e: - # print(f"An error occurred: {e}") + if not os.path.exists(derived_dir): + os.makedirs(derived_dir) + + try: + shutil.move(file_path, derived_dir) + print(f"File '{file_path}' moved to '{derived_dir}' successfully.") + except FileNotFoundError: + print(f"Error: File '{source_file}' not found.") + except Exception as e: + print(f"An error occurred: {e}") else: print(f"'{file_path}' is not a file. Skipping.")