[pypy-commit] pypy default: attempt to fix 12160ae9198a
mattip
pypy.commits at gmail.com
Mon Nov 7 11:50:41 EST 2016
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r88186:c85d4dd82b49
Date: 2016-11-07 18:44 +0200
http://bitbucket.org/pypy/pypy/changeset/c85d4dd82b49/
Log: attempt to fix 12160ae9198a
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
@@ -34,19 +34,37 @@
" or contribute the missing support in PyPy.")
return _get_compiler_type(cc, True)
+def _find_vcvarsall(version):
+ # copied from setuptools.msvc9_support.py
+ from distutils.msvc9compiler import Reg
+ VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f'
+ key = VC_BASE % ('', version)
+ try:
+ # Per-user installs register the compiler path here
+ productdir = Reg.get_value(key, "installdir")
+ except KeyError:
+ try:
+ # All-user installs on a 64-bit system register here
+ key = VC_BASE % ('Wow6432Node\\', version)
+ productdir = Reg.get_value(key, "installdir")
+ except KeyError:
+ productdir = None
+
+ if productdir:
+ vcvarsall = os.path.join(productdir, "vcvarsall.bat")
+ if os.path.isfile(vcvarsall):
+ return vcvarsall
+ return None
+
def _get_msvc_env(vsver, x64flag):
vcvars = None
try:
toolsdir = os.environ['VS%sCOMNTOOLS' % vsver]
except KeyError:
- # try to import from the "Microsoft Visual C++ Compiler for Python 2.7"
- try:
- import setuptools
- except ImportError:
- return None
+ # try to import from the registry, as done in setuptools
# XXX works for 90 but is it generalizable?
toolsdir = ''
- vcvars = setuptools.msvc.msvc9_find_vcvarsall(vsver/10)
+ vcvars = _find_vcvarsall(vsver/10)
if not vcvars:
if x64flag:
More information about the pypy-commit
mailing list