Author: Matti Picus <[email protected]>
Branch: 
Changeset: r93965:63d0a5cf5da2
Date: 2018-03-09 13:48 +0200
http://bitbucket.org/pypy/pypy/changeset/63d0a5cf5da2/

Log:    allow calling MsvcPlatform more than once in the process

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
@@ -162,17 +162,17 @@
 
     def __init__(self, cc=None, x64=False, ver0=None):
         self.x64 = x64
+        patch_os_env(self.externals)
+        self.c_environ = os.environ.copy()
         if cc is None:
             msvc_compiler_environ, self.vsver = find_msvc_env(x64, ver0=ver0)
             Platform.__init__(self, 'cl.exe')
             if msvc_compiler_environ:
+                self.c_environ.update(msvc_compiler_environ)
                 if x64:
                     self.externals_branch = 'win34_%d' % self.vsver
                 else:
                     self.externals_branch = 'win32_%d' % self.vsver
-                patch_env(msvc_compiler_environ, self.externals)
-                self.c_environ = os.environ.copy()
-                self.c_environ.update(msvc_compiler_environ)
         else:
             self.cc = cc
 
@@ -533,17 +533,18 @@
 
 # These are the external libraries, created and maintained by get_externals.py
 # The buildbot runs get_externals before building
-def patch_env(env, externals = Platform.externals):
+def patch_os_env(externals = Platform.externals):
     #print 'adding %s to PATH, INCLUDE, LIB' % basepath
     binpath = externals + r'\bin'
     path = os.environ['PATH']
-    if binpath not in path.split(';'):
+    if binpath not in path:
         path = binpath + ';' + path
-    # make sure externals is in current path for tests and translating
-    os.environ['PATH'] = path
-    env['PATH'] = binpath + ';' + env.get('PATH', '')
-    env['INCLUDE'] = externals + r'\include;' + env.get('INCLUDE', '')
-    env['LIB'] = externals + r'\lib;' + env.get('LIB', '')
+        # make sure externals is in current path for tests and translating
+        os.environ['PATH'] = path
+    if externals not in os.environ.get('INCLUDE', ''):
+        os.environ['INCLUDE'] = externals + r'\include;' + 
os.environ.get('INCLUDE', '')
+    if externals not in os.environ.get('LIB', ''):
+        os.environ['LIB'] = externals + r'\lib;' + os.environ.get('LIB', '')
     return None
 
 class WinDefinition(posix.Definition):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to