Sun, 29 Oct 2023 15:50:37 +0100
Corrected the recent change to the install and uninstall scripts.
scripts/install.py | file | annotate | diff | comparison | revisions | |
scripts/uninstall.py | file | annotate | diff | comparison | revisions |
--- a/scripts/install.py Sun Oct 29 12:19:47 2023 +0100 +++ b/scripts/install.py Sun Oct 29 15:50:37 2023 +0100 @@ -53,10 +53,8 @@ eric7SourceDir = "" configName = "eric7config.py" defaultMacAppBundleName = "eric7.app" -if os.getuid() == 0: - defaultMacAppBundlePath = "/Applications" -else: - defaultMacAppBundlePath = os.path.expanduser("~/Applications") +defaultMacAppBundlePath = "/Applications" +defaultMacUserAppBundlePath = os.path.expanduser("~/Applications") defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( sys.exec_prefix ) @@ -201,7 +199,7 @@ Module function to set the values of globals that need more than a simple assignment. """ - global platBinDir, modDir, pyModDir, apisDir + global platBinDir, modDir, pyModDir, apisDir, macAppBundlePath if sys.platform.startswith(("win", "cygwin")): platBinDir = sysconfig.get_path("scripts") @@ -241,6 +239,12 @@ qtDataDir = None apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None + if sys.platform == "darwin": + if os.getuid() == 0: + macAppBundlePath = defaultMacAppBundlePath + else: + macAppBundlePath = defaultMacUserAppBundlePath + def copyToFile(name, text): """ @@ -672,10 +676,15 @@ macAppBundlePath = getConfig("macAppBundlePath") macAppBundleName = getConfig("macAppBundleName") except AttributeError: - macAppBundlePath = defaultMacAppBundlePath + macAppBundlePath = ( + defaultMacAppBundlePath + if os.getpid() == 0 + else defaultMacUserAppBundlePath + ) macAppBundleName = defaultMacAppBundleName for bundlePath in [ os.path.join(defaultMacAppBundlePath, macAppBundleName), + os.path.join(defaultMacUserAppBundlePath, macAppBundleName), os.path.join(macAppBundlePath, macAppBundleName), ]: if os.path.exists(bundlePath): @@ -1582,7 +1591,7 @@ } try: - isSudo = os.getuid() == 0 and sys.platform != "darwin" + isSudo = os.getuid() == 0 # disregard sudo installs on macOS except AttributeError: isSudo = False @@ -2273,11 +2282,11 @@ ) print("ERROR: {0}".format(str(exc))) cfg = {} - elif opt == "-m": + elif opt == "-m" and sys.platform == "darwin": macAppBundleName = arg - elif opt == "-n": + elif opt == "-n" and sys.platform == "darwin": macAppBundlePath = arg - elif opt == "-p": + elif opt == "-p" and sys.platform == "darwin": macPythonExe = arg elif opt == "--no-apis": installApis = False
--- a/scripts/uninstall.py Sun Oct 29 12:19:47 2023 +0100 +++ b/scripts/uninstall.py Sun Oct 29 15:50:37 2023 +0100 @@ -24,10 +24,8 @@ pyModDir = None progLanguages = ["MicroPython", "Python3", "QSS"] defaultMacAppBundleName = "eric7.app" -if os.getuid() == 0: - defaultMacAppBundlePath = "/Applications" -else: - defaultMacAppBundlePath = os.path.expanduser("~/Applications") +defaultMacAppBundlePath = "/Applications" +defaultMacUserAppBundlePath = os.path.expanduser("~/Applications") settingsNameOrganization = "Eric7" settingsNameGlobal = "eric7" @@ -343,10 +341,15 @@ macAppBundlePath = getConfig("macAppBundlePath") macAppBundleName = getConfig("macAppBundleName") except AttributeError: - macAppBundlePath = defaultMacAppBundlePath + macAppBundlePath = ( + defaultMacAppBundlePath + if os.getpid() == 0 + else defaultMacUserAppBundlePath + ) macAppBundleName = defaultMacAppBundleName for bundlePath in [ os.path.join(defaultMacAppBundlePath, macAppBundleName), + os.path.join(defaultMacUserAppBundlePath, macAppBundleName), os.path.join(macAppBundlePath, macAppBundleName), ]: if os.path.exists(bundlePath):