parent
e777364f91
commit
9991dd6ce4
6
setup.py
6
setup.py
@ -576,6 +576,7 @@ make && make docs
|
|||||||
|
|
||||||
def compile_python(base_path):
|
def compile_python(base_path):
|
||||||
import compileall
|
import compileall
|
||||||
|
import py_compile
|
||||||
try:
|
try:
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
num_workers = max(1, cpu_count())
|
num_workers = max(1, cpu_count())
|
||||||
@ -585,7 +586,10 @@ def compile_python(base_path):
|
|||||||
for f in files:
|
for f in files:
|
||||||
if f.rpartition('.')[-1] in ('pyc', 'pyo'):
|
if f.rpartition('.')[-1] in ('pyc', 'pyo'):
|
||||||
os.remove(os.path.join(root, f))
|
os.remove(os.path.join(root, f))
|
||||||
compileall.compile_dir(base_path, ddir='', force=True, optimize=1, quiet=1, workers=num_workers)
|
kwargs = dict(ddir='', force=True, optimize=1, quiet=1, workers=num_workers)
|
||||||
|
if hasattr(py_compile, 'PycInvalidationMode'):
|
||||||
|
kwargs['invalidation_mode'] = py_compile.PycInvalidationMode.UNCHECKED_HASH
|
||||||
|
compileall.compile_dir(base_path, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def package(args, for_bundle=False, sh_launcher=False):
|
def package(args, for_bundle=False, sh_launcher=False):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user