monkeypatch_distutils.py (pymol-v1.8.6.0.tar.bz2) | : | monkeypatch_distutils.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
except ImportError: | except ImportError: | |||
_osx_support = None | _osx_support = None | |||
distutils.unixccompiler.UnixCCompiler.executables.update({ | distutils.unixccompiler.UnixCCompiler.executables.update({ | |||
'compiler_cxx' : ["c++"], | 'compiler_cxx' : ["c++"], | |||
'compiler_so_cxx' : ["c++"], | 'compiler_so_cxx' : ["c++"], | |||
'linker_so_cxx' : ["c++", "-shared"], | 'linker_so_cxx' : ["c++", "-shared"], | |||
'linker_exe_cxx' : ["c++"], | 'linker_exe_cxx' : ["c++"], | |||
}) | }) | |||
def set_parallel_jobs(N): | ||||
''' | ||||
Set the number of parallel build jobs. | ||||
N=1 : single threaded | ||||
N=0 : use number of CPUs | ||||
''' | ||||
global pmap | ||||
if N == 1: | ||||
pmap = map | ||||
else: | ||||
from multiprocessing import pool | ||||
pmap = pool.ThreadPool(N or None).map | ||||
def monkeypatch(parent, name): | def monkeypatch(parent, name): | |||
''' | ''' | |||
Decorator to replace a function or class method. Makes the | Decorator to replace a function or class method. Makes the | |||
unpatched function available as <patchedfunction>._super | unpatched function available as <patchedfunction>._super | |||
''' | ''' | |||
def wrapper(func): | def wrapper(func): | |||
orig = getattr(parent, name) | orig = getattr(parent, name) | |||
func._super = orig | func._super = orig | |||
func.__name__ = name | func.__name__ = name | |||
setattr(parent, name, func) | setattr(parent, name, func) | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added |