summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/build.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-09-26 21:31:59 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-09-26 21:31:59 (GMT)
commit2c0a91606105e1606d886c198ea7ed1b195c692f (patch)
treefe0a91c1f633ab3dc48fad0c63f8960695b21ac3 /Lib/distutils/command/build.py
parent7e23d82cec31c1035fb7d7808443a80e129dd112 (diff)
downloadcpython-2c0a91606105e1606d886c198ea7ed1b195c692f.zip
cpython-2c0a91606105e1606d886c198ea7ed1b195c692f.tar.gz
cpython-2c0a91606105e1606d886c198ea7ed1b195c692f.tar.bz2
Issue #5309: distutils' build and build_ext commands now accept a ``-j``
option to enable parallel building of extension modules.
Diffstat (limited to 'Lib/distutils/command/build.py')
-rw-r--r--Lib/distutils/command/build.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/distutils/command/build.py b/Lib/distutils/command/build.py
index cfc15cf..337dd0b 100644
--- a/Lib/distutils/command/build.py
+++ b/Lib/distutils/command/build.py
@@ -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