--- a/scripts/uninstall.py Sat Sep 07 14:45:27 2019 +0200 +++ b/scripts/uninstall.py Sat Sep 07 16:10:29 2019 +0200 @@ -18,32 +18,16 @@ import glob import distutils.sysconfig -if sys.version_info[0] == 2: - try: - from PyQt5 import sip - except ImportError: - import sip - sip.setapi('QString', 2) -else: - raw_input = input - # Define the globals. progName = None currDir = os.getcwd() pyModDir = None progLanguages = ["Python", "Ruby", "QSS"] -includePythonVariant = False defaultMacAppBundleName = "eric6.app" defaultMacAppBundlePath = "/Applications" settingsNameOrganization = "Eric6" settingsNameGlobal = "eric6" -# Define file name markers for Python variants -PythonMarkers = { - 2: "_py2", - 3: "_py3", -} - def exit(rcode=0): """ @@ -60,7 +44,6 @@ os.rename("eric6config.py.orig", "eric6config.py") if sys.platform.startswith(("win", "cygwin")): - # different meaning of input between Py2 and Py3 try: input("Press enter to continue...") except (EOFError, SyntaxError): @@ -96,7 +79,6 @@ print(" {0} [-h]".format(progName)) print("where:") print(" -h display this help message") - print(" -y remove executables with Python variant in name") exit(rcode) @@ -151,13 +133,11 @@ "eric6_tray", "eric6_editor", "eric6_plugininstall", "eric6_pluginuninstall", "eric6_pluginrepository", "eric6_sqlbrowser", - "eric6_webbrowser", "eric6_iconeditor", - "eric6_snap", "eric6_hexeditor", "eric6_browser", - "eric6_shell", + "eric6_iconeditor", "eric6_snap", "eric6_hexeditor", + "eric6_browser", "eric6_shell", + # from Python2 era + "eric6_webbrowser", ] - if includePythonVariant: - marker = PythonMarkers[sys.version_info.major] - rem_wnames = [n + marker for n in rem_wnames] try: for rem_wname in rem_wnames: @@ -273,20 +253,15 @@ "/usr/share/pixmaps/ericWeb.png"]: if os.path.exists(name): os.remove(name) - if includePythonVariant: - marker = PythonMarkers[sys.version_info.major] - else: - marker = "" for name in [ - "/usr/share/applications/eric6" + marker + ".desktop", - "/usr/share/appdata/eric6" + marker + ".appdata.xml", - "/usr/share/metainfo/eric6" + marker + ".appdata.xml", - "/usr/share/applications/eric6_webbrowser" + marker + - ".desktop", - "/usr/share/applications/eric6_browser" + marker + - ".desktop", - "/usr/share/pixmaps/eric" + marker + ".png", - "/usr/share/pixmaps/ericWeb" + marker + ".png", + "/usr/share/applications/eric6.desktop", + "/usr/share/appdata/eric6.appdata.xml", + "/usr/share/metainfo/eric6.appdata.xml", + "/usr/share/applications/eric6_browser.desktop", + "/usr/share/pixmaps/eric.png", + "/usr/share/pixmaps/ericWeb.png", + # from Python2 era + "/usr/share/applications/eric6_webbrowser.desktop", ]: if os.path.exists(name): os.remove(name) @@ -297,20 +272,15 @@ path = os.path.expanduser(name) if os.path.exists(path): os.remove(path) - if includePythonVariant: - marker = PythonMarkers[sys.version_info.major] - else: - marker = "" for name in [ - "~/.local/share/applications/eric6" + marker + ".desktop", - "~/.local/share/appdata/eric6" + marker + ".appdata.xml", - "~/.local/share/metainfo/eric6" + marker + ".appdata.xml", - "~/.local/share/applications/eric6_webbrowser" + marker + - ".desktop", - "~/.local/share/applications/eric6_browser" + marker + - ".desktop", - "~/.local/share/pixmaps/eric" + marker + ".png", - "~/.local/share/pixmaps/ericWeb" + marker + ".png", + "~/.local/share/applications/eric6.desktop", + "~/.local/share/appdata/eric6.appdata.xml", + "~/.local/share/metainfo/eric6.appdata.xml", + "~/.local/share/applications/eric6_browser.desktop", + "~/.local/share/pixmaps/eric.png", + "~/.local/share/pixmaps/ericWeb.png", + # from Python2 era + "/usr/share/applications/eric6_webbrowser.desktop", ]: path = os.path.expanduser(name) if os.path.exists(path): @@ -358,8 +328,7 @@ print(" - {0}".format(path)) answer = "c" while answer not in ["y", "Y", "n", "N", ""]: - answer = raw_input( - "Shall these directories be removed (y/N)? ") + answer = input("Shall these directories be removed (y/N)? ") if answer in ["y", "Y"]: for path in pathsToRemove: shutil.rmtree(path) @@ -375,8 +344,7 @@ print(" - {0}".format(cfg)) answer = "c" while answer not in ["y", "Y", "n", "N", ""]: - answer = raw_input( - "Shall this directory be removed (y/N)? ") + answer = input("Shall this directory be removed (y/N)? ") if answer in ["y", "Y"]: shutil.rmtree(cfg) @@ -388,12 +356,9 @@ try: from PyQt5.QtCore import QSettings except ImportError: - try: - from PyQt4.QtCore import QSettings - except ImportError: - print("No PyQt variant installed. The configuration directory") - print("cannot be determined. You have to remove it manually.\n") - return + print("No PyQt variant installed. The configuration directory") + print("cannot be determined. You have to remove it manually.\n") + return settings = QSettings(QSettings.IniFormat, QSettings.UserScope, settingsNameOrganization, settingsNameGlobal) @@ -403,8 +368,7 @@ print(" - {0}".format(settingsDir)) answer = "c" while answer not in ["y", "Y", "n", "N", ""]: - answer = raw_input( - "Shall this directory be removed (y/N)? ") + answer = input("Shall this directory be removed (y/N)? ") if answer in ["y", "Y"]: shutil.rmtree(settingsDir) @@ -477,8 +441,6 @@ """ import getopt - global includePythonVariant - initGlobals() # Parse the command line. @@ -495,8 +457,6 @@ for opt, _arg in optlist: if opt == "-h": usage(0) - if opt == "-y": - includePythonVariant = True print("\nUninstalling eric6 ...") uninstallEric()