install.py

changeset 5055
7db1b9496e52
parent 4915
8081031061a2
child 5102
9cc5217881ab
--- a/install.py	Sun Jul 24 16:50:36 2016 +0200
+++ b/install.py	Sun Jul 24 16:51:17 2016 +0200
@@ -469,10 +469,11 @@
             if os.path.exists(os.path.join(dirName, sourceName + "c")):
                 os.remove(os.path.join(dirName, sourceName + "c"))
     
-    # step 2: delete the __pycache__ directory and all *.pyc files
+    # step 2: delete the __pycache__ directory and all remaining *.pyc files
     if os.path.exists(os.path.join(dirName, "__pycache__")):
         shutil.rmtree(os.path.join(dirName, "__pycache__"))
-    for name in [f for f in dirListing if fnmatch.fnmatch(f, "*.pyc")]:
+    for name in [f for f in os.listdir(dirName)
+                 if fnmatch.fnmatch(f, "*.pyc")]:
         os.remove(os.path.join(dirName, name))
     
     # step 3: descent into subdirectories and delete them if empty
@@ -1477,13 +1478,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,
@@ -1492,7 +1497,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"))

eric ide

mercurial