scripts/uninstall.py

branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 6942
2602857055c5
child 7203
2079ccbfa335
diff -r 960850ec284c -r a22eee00b052 scripts/uninstall.py
--- a/scripts/uninstall.py	Sat Aug 31 12:29:57 2019 +0200
+++ b/scripts/uninstall.py	Sat Aug 31 12:58:11 2019 +0200
@@ -18,15 +18,6 @@
 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
-
 # get a local eric6config.py out of the way
 if os.path.exists("eric6config.py"):
     os.rename("eric6config.py", "eric6config.py.orig")
@@ -37,18 +28,11 @@
 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):
     """
@@ -65,7 +49,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):
@@ -88,7 +71,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)
 
@@ -143,13 +125,9 @@
         "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",
     ]
-    if includePythonVariant:
-        marker = PythonMarkers[sys.version_info.major]
-        rem_wnames = [n + marker for n in rem_wnames]
     
     try:
         for rem_wname in rem_wnames:
@@ -265,20 +243,13 @@
                      "/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",
         ]:
             if os.path.exists(name):
                 os.remove(name)
@@ -289,20 +260,13 @@
             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",
         ]:
             path = os.path.expanduser(name)
             if os.path.exists(path):
@@ -350,8 +314,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)
@@ -367,8 +330,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)
 
@@ -380,12 +342,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)
@@ -395,8 +354,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)
 
@@ -469,8 +427,6 @@
     """
     import getopt
 
-    global includePythonVariant
-    
     initGlobals()
 
     # Parse the command line.
@@ -487,8 +443,6 @@
     for opt, _arg in optlist:
         if opt == "-h":
             usage(0)
-        if opt == "-y":
-            includePythonVariant = True
     
     print("\nUninstalling eric6 ...")
     uninstallEric()

eric ide

mercurial