diff --git a/mp_compile.py b/mp_compile.py index 0ff5b4b62..71b4089e1 100644 --- a/mp_compile.py +++ b/mp_compile.py @@ -5,6 +5,7 @@ from multiprocessing import Pool, cpu_count from distutils.ccompiler import CCompiler import os + # hideous monkeypatching. but. but. but. def _mp_compile_one(tp): (self, obj, build, cc_args, extra_postargs, pp_opts) = tp @@ -15,21 +16,20 @@ def _mp_compile_one(tp): self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) return + def _mp_compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None): """Compile one or more source files. - + see distutils.ccompiler.CCompiler.compile for comments. """ # A concrete compiler class can either override this method # entirely or implement _compile(). - - macros, objects, extra_postargs, pp_opts, build = \ - self._setup_compile(output_dir, macros, include_dirs, sources, - depends, extra_postargs) - cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) + macros, objects, extra_postargs, pp_opts, build = self._setup_compile( + output_dir, macros, include_dirs, sources, depends, extra_postargs) + cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) try: max_procs = int(os.environ.get('MAX_CONCURRENCY', cpu_count())) @@ -38,10 +38,12 @@ def _mp_compile(self, sources, output_dir=None, macros=None, pool = Pool(max_procs) try: print ("Building using %d processes" % pool._processes) - except: pass - arr = [(self, obj, build, cc_args, extra_postargs, pp_opts) for obj in objects] - results = pool.map_async(_mp_compile_one,arr) - + except: + pass + arr = [ + (self, obj, build, cc_args, extra_postargs, pp_opts) for obj in objects + ] + pool.map_async(_mp_compile_one, arr) pool.close() pool.join() # Return *all* object filenames, not just the ones we just built. diff --git a/setup.py b/setup.py index 1a31a8981..e0a22f75f 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,6 @@ import re import struct import sys -import mp_compile - from distutils.command.build_ext import build_ext from distutils import sysconfig from setuptools import Extension, setup, find_packages @@ -707,7 +705,7 @@ class pil_build_ext(build_ext): finally: os.unlink(tmpfile) -if __name__=='__main__': +if __name__ == '__main__': setup( name=NAME, version=VERSION, @@ -742,5 +740,4 @@ if __name__=='__main__': license='Standard PIL License', zip_safe=True, ) - # End of file diff --git a/test-installed.py b/test-installed.py index 7f58f4966..0248590a5 100755 --- a/test-installed.py +++ b/test-installed.py @@ -4,8 +4,8 @@ import os import sys import glob -# monkey with the path, removing the local directory but adding the Tests/ directory -# for helper.py and the other local imports there. +# monkey with the path, removing the local directory but adding the Tests/ +# directory for helper.py and the other local imports there. del(sys.path[0]) sys.path.insert(0, os.path.abspath('./Tests')) @@ -16,7 +16,7 @@ sys.path.insert(0, os.path.abspath('./Tests')) if len(sys.argv) == 1: sys.argv.extend(glob.glob('Tests/test*.py')) -# Make sure that nose doesn't muck with our paths. +# Make sure that nose doesn't muck with our paths. if ('--no-path-adjustment' not in sys.argv) and ('-P' not in sys.argv): sys.argv.insert(1, '--no-path-adjustment')