Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions build/sage_bootstrap/uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ def modern_uninstall(spkg_name, sage_local, files, verbose=False):
else:
sys.exit(1)

# Run the package's piprm script, if it exists.
# Since #36452 the spkg-requirements.txt file appears in the installation
# manifest, so this step has to happen before removing the files.
try:
run_spkg_script(spkg_name, spkg_scripts, 'piprm',
'pip-uninstall')
except Exception:
print("Warning: Error running the pip-uninstall script for "
"'{0}'; uninstallation may have left behind some files".format(
spkg_name), file=sys.stderr)

def rmdir(dirname):
if pth.isdir(dirname):
if not os.listdir(dirname):
Expand Down Expand Up @@ -200,15 +211,6 @@ def rmdir(dirname):
# Remove file's directory if it is now empty
rmdir(dirname)

# Run the package's piprm script, if it exists.
try:
run_spkg_script(spkg_name, spkg_scripts, 'piprm',
'pip-uninstall')
except Exception:
print("Warning: Error running the pip-uninstall script for "
"'{0}'; uninstallation may have left behind some files".format(
spkg_name), file=sys.stderr)

# Run the package's postrm script, if it exists.
# If an error occurs here print a warning, but complete the
# uninstallation; otherwise we leave the package in a broken
Expand Down