diff --git a/src/Mod/AddonManager/AddonManager.py b/src/Mod/AddonManager/AddonManager.py index 56deafdbf7..8b88b4eeee 100644 --- a/src/Mod/AddonManager/AddonManager.py +++ b/src/Mod/AddonManager/AddonManager.py @@ -1503,6 +1503,15 @@ class CommandAddonManager: ).format(macro_filename) ) + # Second, run the Addon's "uninstall.py" script, if it exists + uninstall_script = os.path.join(clonedir,"uninstall.py") + if os.path.exists(uninstall_script): + try: + with open(uninstall_script, 'r') as f: + exec(f.read()) + except Exception: + FreeCAD.Console.PrintError(translate("AddonsInstaller","Execution of Addon's uninstall.py script failed. Proceeding with uninstall...") + "\n") + if os.path.exists(clonedir): shutil.rmtree(clonedir, onerror=self.remove_readonly) self.item_model.update_item_status(