[pypy-commit] pypy default: add even more debug to msvc compiler detection.

mattip pypy.commits at gmail.com
Wed Jan 16 01:43:22 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r95644:e515811660b6
Date: 2019-01-16 08:42 +0200
http://bitbucket.org/pypy/pypy/changeset/e515811660b6/

Log:	add even more debug to msvc compiler detection.

	We should rip this out and use distutils/setuptools.

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
@@ -86,12 +86,14 @@
                                  stderr=subprocess.PIPE)
 
             stdout, stderr = popen.communicate()
-            if popen.wait() != 0:
+            if popen.wait() != 0 or stdout[:5].lower() == 'error':
+                log.msg('Running "%s" errored: \n\nstdout:\n%s\n\nstderr:\n%s' % (
+                    vcvars, stdout.split()[0], stderr))
                 return None
-            if stdout[:5].lower() == 'error':
-                log.msg('Running "%s" errored: %s' %(vcvars, stdout.split()[0]))
-                return None
-        except:
+            else:
+                log.msg('Running "%s" succeeded' %(vcvars,))
+        except Exception as e:
+            log.msg('Running "%s" failed: "%s"', (vcvars, str(e)))
             return None
 
         stdout = stdout.replace("\r\n", "\n")
@@ -180,8 +182,13 @@
             self.cc = cc
 
         # detect version of current compiler
-        returncode, stdout, stderr = _run_subprocess(self.cc, [],
+        try:
+            returncode, stdout, stderr = _run_subprocess(self.cc, [],
                                                      env=self.c_environ)
+        except EnvironmentError:
+            log.msg('Could not run %s using PATH=\n%s' %(self.cc,
+                '\n'.join(self.c_environ['PATH'].split(';'))))
+            raise
         r = re.search(r'Microsoft.+C/C\+\+.+\s([0-9]+)\.([0-9]+).*', stderr)
         if r is not None:
             self.version = int(''.join(r.groups())) / 10 - 60


More information about the pypy-commit mailing list