467 if not os.path.exists(os.path.join(dirName, formName)): |
467 if not os.path.exists(os.path.join(dirName, formName)): |
468 os.remove(os.path.join(dirName, sourceName)) |
468 os.remove(os.path.join(dirName, sourceName)) |
469 if os.path.exists(os.path.join(dirName, sourceName + "c")): |
469 if os.path.exists(os.path.join(dirName, sourceName + "c")): |
470 os.remove(os.path.join(dirName, sourceName + "c")) |
470 os.remove(os.path.join(dirName, sourceName + "c")) |
471 |
471 |
472 # step 2: delete the __pycache__ directory and all *.pyc files |
472 # step 2: delete the __pycache__ directory and all remaining *.pyc files |
473 if os.path.exists(os.path.join(dirName, "__pycache__")): |
473 if os.path.exists(os.path.join(dirName, "__pycache__")): |
474 shutil.rmtree(os.path.join(dirName, "__pycache__")) |
474 shutil.rmtree(os.path.join(dirName, "__pycache__")) |
475 for name in [f for f in dirListing if fnmatch.fnmatch(f, "*.pyc")]: |
475 for name in [f for f in os.listdir(dirName) |
|
476 if fnmatch.fnmatch(f, "*.pyc")]: |
476 os.remove(os.path.join(dirName, name)) |
477 os.remove(os.path.join(dirName, name)) |
477 |
478 |
478 # step 3: descent into subdirectories and delete them if empty |
479 # step 3: descent into subdirectories and delete them if empty |
479 for name in os.listdir(dirName): |
480 for name in os.listdir(dirName): |
480 name = os.path.join(dirName, name) |
481 name = os.path.join(dirName, name) |
1475 # step 2: compile the forms |
1476 # step 2: compile the forms |
1476 compileUiFiles() |
1477 compileUiFiles() |
1477 |
1478 |
1478 if doCompile: |
1479 if doCompile: |
1479 print("\nCompiling source files ...") |
1480 print("\nCompiling source files ...") |
|
1481 if sys.version_info[0] == 3: |
|
1482 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
|
1483 else: |
|
1484 skipRe = re.compile(r"DebugClients[\\/]Python3[\\/]") |
1480 # Hide compile errors (mainly because of Py2/Py3 differences) |
1485 # Hide compile errors (mainly because of Py2/Py3 differences) |
1481 sys.stdout = io.StringIO() |
1486 sys.stdout = io.StringIO() |
1482 if distDir: |
1487 if distDir: |
1483 compileall.compile_dir( |
1488 compileall.compile_dir( |
1484 sourceDir, |
1489 sourceDir, |
1485 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
1490 ddir=os.path.join(distDir, modDir, cfg['ericDir']), |
1486 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1491 rx=skipRe, |
1487 quiet=True) |
1492 quiet=True) |
1488 py_compile.compile( |
1493 py_compile.compile( |
1489 configName, |
1494 configName, |
1490 dfile=os.path.join(distDir, modDir, "eric6config.py")) |
1495 dfile=os.path.join(distDir, modDir, "eric6config.py")) |
1491 else: |
1496 else: |
1492 compileall.compile_dir( |
1497 compileall.compile_dir( |
1493 sourceDir, |
1498 sourceDir, |
1494 ddir=os.path.join(modDir, cfg['ericDir']), |
1499 ddir=os.path.join(modDir, cfg['ericDir']), |
1495 rx=re.compile(r"DebugClients[\\/]Python[\\/]"), |
1500 rx=skipRe, |
1496 quiet=True) |
1501 quiet=True) |
1497 py_compile.compile(configName, |
1502 py_compile.compile(configName, |
1498 dfile=os.path.join(modDir, "eric6config.py")) |
1503 dfile=os.path.join(modDir, "eric6config.py")) |
1499 sys.stdout = sys.__stdout__ |
1504 sys.stdout = sys.__stdout__ |
1500 print("\nInstalling eric6 ...") |
1505 print("\nInstalling eric6 ...") |