Issue #5309: distutils' build and build_ext commands now accept a `-j`

option to enable parallel building of extension modules.
This commit is contained in:
Antoine Pitrou 2014-09-26 23:31:59 +02:00
parent 7e23d82cec
commit 2c0a916061
6 changed files with 117 additions and 28 deletions

View file

@ -36,6 +36,8 @@ class build(Command):
"(default: %s)" % get_platform()),
('compiler=', 'c',
"specify the compiler type"),
('parallel=', 'j',
"number of parallel build jobs"),
('debug', 'g',
"compile extensions and libraries with debugging information"),
('force', 'f',
@ -65,6 +67,7 @@ class build(Command):
self.debug = None
self.force = 0
self.executable = None
self.parallel = None
def finalize_options(self):
if self.plat_name is None:
@ -116,6 +119,12 @@ class build(Command):
if self.executable is None:
self.executable = os.path.normpath(sys.executable)
if isinstance(self.parallel, str):
try:
self.parallel = int(self.parallel)
except ValueError:
raise DistutilsOptionError("parallel should be an integer")
def run(self):
# Run all relevant sub-commands. This will be some subset of:
# - build_py - pure Python modules