Author: Matti Picus <matti.pi...@gmail.com> Branch: Changeset: r88162:12160ae9198a Date: 2016-11-06 20:48 +0200 http://bitbucket.org/pypy/pypy/changeset/12160ae9198a/
Log: hack to let setuptools find the msvc compiler (maybe), document Windows 10 experience diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst --- a/pypy/doc/windows.rst +++ b/pypy/doc/windows.rst @@ -20,6 +20,22 @@ .. _our downloads: http://pypy.org/download.html +Installing Visual Compiler v9 (for Python 2.7) +---------------------------------------------- + +This compiler, while the standard one for Python 2.7, is depricated. Microsoft has +made it available as the `Microsoft Visual C++ Compiler for Python 2.7`_ (the link +was checked in Nov 2016). Note that the compiler suite will be installed in +``C:\Users\<user name>\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python``. +Using a current version of ``setuptools`` will be able to find it there. For +Windows 10, you must right-click the download, and under ``Properties`` -> +``Compatibility`` mark it as ``Run run this program in comatibility mode for`` +``Previous version...``. Also, you must download and install the ``.Net Framework 3.5``, +otherwise ``mt.exe`` will silently fail. Installation will begin automatically +by running the mt.exe command by hand from a DOS window (that is how the author +discovered the problem). + +.. _Microsoft Visual C++ Compiler for Python 2.7: https://www.microsoft.com/en-us/download/details.aspx?id=44266 Translating PyPy with Visual Studio ----------------------------------- 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 @@ -35,18 +35,27 @@ return _get_compiler_type(cc, True) def _get_msvc_env(vsver, x64flag): + vcvars = None try: toolsdir = os.environ['VS%sCOMNTOOLS' % vsver] except KeyError: - return None + # try to import from the "Microsoft Visual C++ Compiler for Python 2.7" + try: + import setuptools + except ImportError: + return None + # XXX works for 90 but is it generalizable? + toolsdir = '' + vcvars = setuptools.msvc.msvc9_find_vcvarsall(vsver/10) - if x64flag: - vsinstalldir = os.path.abspath(os.path.join(toolsdir, '..', '..')) - vcinstalldir = os.path.join(vsinstalldir, 'VC') - vcbindir = os.path.join(vcinstalldir, 'BIN') - vcvars = os.path.join(vcbindir, 'amd64', 'vcvarsamd64.bat') - else: - vcvars = os.path.join(toolsdir, 'vsvars32.bat') + if not vcvars: + if x64flag: + vsinstalldir = os.path.abspath(os.path.join(toolsdir, '..', '..')) + vcinstalldir = os.path.join(vsinstalldir, 'VC') + vcbindir = os.path.join(vcinstalldir, 'BIN') + vcvars = os.path.join(vcbindir, 'amd64', 'vcvarsamd64.bat') + else: + vcvars = os.path.join(toolsdir, 'vsvars32.bat') import subprocess try: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit