Some enhancements to the install and uninstall scripts. 6_1_x

Sun, 24 Jul 2016 16:51:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 24 Jul 2016 16:51:17 +0200
branch
6_1_x
changeset 5058
41df96c4c8ce
parent 5057
6911444f5b9b
child 5060
56eee32610a3

Some enhancements to the install and uninstall scripts.
(grafted from 7db1b9496e52076e44ad2d54dec9619d6379b0ef)

install.py file | annotate | diff | comparison | revisions
uninstall.py file | annotate | diff | comparison | revisions
--- a/install.py	Sun Jul 24 16:53:14 2016 +0200
+++ b/install.py	Sun Jul 24 16:51:17 2016 +0200
@@ -1465,13 +1465,17 @@
     
     if doCompile:
         print("\nCompiling source files ...")
+        if sys.version_info[0] == 3:
+            skipRe = re.compile(r"DebugClients[\\/]Python[\\/]")
+        else:
+            skipRe = re.compile(r"DebugClients[\\/]Python3[\\/]")
         # Hide compile errors (mainly because of Py2/Py3 differences)
         sys.stdout = io.StringIO()
         if distDir:
             compileall.compile_dir(
                 sourceDir,
                 ddir=os.path.join(distDir, modDir, cfg['ericDir']),
-                rx=re.compile(r"DebugClients[\\/]Python[\\/]"),
+                rx=skipRe,
                 quiet=True)
             py_compile.compile(
                 configName,
@@ -1480,7 +1484,7 @@
             compileall.compile_dir(
                 sourceDir,
                 ddir=os.path.join(modDir, cfg['ericDir']),
-                rx=re.compile(r"DebugClients[\\/]Python[\\/]"),
+                rx=skipRe,
                 quiet=True)
             py_compile.compile(configName,
                                dfile=os.path.join(modDir, "eric6config.py"))
--- a/uninstall.py	Sun Jul 24 16:53:14 2016 +0200
+++ b/uninstall.py	Sun Jul 24 16:51:17 2016 +0200
@@ -50,11 +50,24 @@
     
     @param rcode result code to report back (integer)
     """
+    global currDir
+    
     # restore the local eric6config.py
     if os.path.exists("eric6config.py.orig"):
         if os.path.exists("eric6config.py"):
             os.remove("eric6config.py")
         os.rename("eric6config.py.orig", "eric6config.py")
+    
+    if sys.platform.startswith("win"):
+        # different meaning of input between Py2 and Py3
+        try:
+            input("Press enter to continue...")
+        except (EOFError, SyntaxError):
+            pass
+    
+    os.chdir(currDir)
+    
+    sys.exit(rcode)
 
 
 def usage(rcode=2):
@@ -343,14 +356,10 @@
         if opt == "-y":
             includePythonVariant = True
     
-    try:
-        uninstallEric()
-    except IOError as msg:
-        sys.stderr.write(
-            'IOError: {0}\nTry uninstall with admin rights.\n'.format(msg))
-    except OSError as msg:
-        sys.stderr.write(
-            'OSError: {0}\nTry uninstall with admin rights.\n'.format(msg))
+    print("\nUninstalling eric6 ...")
+    uninstallEric()
+    print("\nUninstallation complete.")
+    print()
     
     exit(0)
 

eric ide

mercurial