[pypy-commit] pypy default: win32: use jom.exe for parallel builds if available

mattip pypy.commits at gmail.com
Wed May 10 08:25:09 EDT 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r91219:e1fb7a07c627
Date: 2017-05-10 15:24 +0300
http://bitbucket.org/pypy/pypy/changeset/e1fb7a07c627/

Log:	win32: use jom.exe for parallel builds if available

diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -119,6 +119,31 @@
     log.error("Could not find a Microsoft Compiler")
     # Assume that the compiler is already part of the environment
 
+# copied from distutils.spawn
+def _find_executable(executable, path=None):
+    """Tries to find 'executable' in the directories listed in 'path'.
+
+    A string listing directories separated by 'os.pathsep'; defaults to
+    os.environ['PATH'].  Returns the complete filename or None if not found.
+    """
+    if path is None:
+        path = os.environ['PATH']
+    paths = path.split(os.pathsep)
+
+    for ext in '.exe', '':
+        newexe = executable + ext
+
+        if os.path.isfile(newexe):
+            return newexe
+        else:
+            for p in paths:
+                f = os.path.join(p, newexe)
+                if os.path.isfile(f):
+                    # the file exists, we have a shot at spawn working
+                    return f
+    return None
+
+
 class MsvcPlatform(Platform):
     name = "msvc"
     so_ext = 'dll'
@@ -128,6 +153,9 @@
 
     cc = 'cl.exe'
     link = 'link.exe'
+    make = 'nmake'
+    if _find_executable('jom.exe'):
+        make = 'jom.exe'
 
     cflags = ('/MD', '/O2', '/Zi')
     link_flags = ('/debug','/LARGEADDRESSAWARE')
@@ -483,11 +511,11 @@
             path = path_to_makefile.makefile_dir
         else:
             path = path_to_makefile
-        log.execute('make %s in %s' % (" ".join(extra_opts), path))
+        log.execute('%s %s in %s' % (self.make, " ".join(extra_opts), path))
         oldcwd = path.chdir()
         try:
             returncode, stdout, stderr = _run_subprocess(
-                'nmake',
+                self.make,
                 ['/nologo', '/f', str(path.join('Makefile'))] + extra_opts,
                 env = self.c_environ)
         finally:


More information about the pypy-commit mailing list