Skip to content

Commit

Permalink
Build: Some files may have already been removed.
Browse files Browse the repository at this point in the history
Symlinks for example?

part of CURA-12229
  • Loading branch information
rburema committed Oct 30, 2024
1 parent cd2e422 commit 86f12f6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,17 @@ def _delete_unwanted_binaries(self, root):
to_remove_dirs.append(pathname)
break
for file in to_remove_files:
os.remove(file)
print(f"deleted file: {file}")
try:
os.remove(file)
print(f"deleted file: {file}")
except Exception as ex:
print(f"WARNING: Attempt to delete file {file} results in: {str(ex)}")
for dir_ in to_remove_dirs:
rmdir(self, dir_)
print(f"deleted dir_: {dir_}")
try:
rmdir(self, dir_)
print(f"deleted dir_: {dir_}")
except Exception as ex:
print(f"WARNING: Attempt to delete folder {dir_} results in: {str(ex)}")

def _generate_pyinstaller_spec(self, location, entrypoint_location, icon_path, entitlements_file):
pyinstaller_metadata = self.conan_data["pyinstaller"]
Expand Down Expand Up @@ -338,8 +344,11 @@ def _generate_pyinstaller_spec(self, location, entrypoint_location, icon_path, e
# In case the installer isn't actually pyinstaller (Windows at the moment), outright remove the offending files:
specifically_delete = set(binaries) - set(filtered_binaries)
for (unwanted_path, _) in specifically_delete:
print(f"delete: {unwanted_path}")
os.remove(unwanted_path)
try:
os.remove(unwanted_path)
print(f"delete: {unwanted_path}")
except Exception as ex:
print(f"WARNING: Attempt to delete binary {unwanted_path} results in: {str(ex)}")

# Write the actual file:
with open(os.path.join(location, "UltiMaker-Cura.spec"), "w") as f:
Expand Down

0 comments on commit 86f12f6

Please sign in to comment.