Skip to content

Commit

Permalink
KPMP-5665: make sure it's a file
Browse files Browse the repository at this point in the history
  • Loading branch information
zwright committed Dec 17, 2024
1 parent 1571425 commit 11310fa
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions scripts/packageChecker/packageChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,21 @@ def find_empty_packages(self, move_derived=False):
def move_file_to_derived(self, package_directory, file_name):
derived_dir = package_directory + "/derived"
file_path = package_directory + "/" + file_name
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 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}")
else:
print(f"'{file_path}' is not a file. Skipping.")



if __name__ == "__main__":
Expand Down

0 comments on commit 11310fa

Please sign in to comment.