diff options
author | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-08-10 18:01:29 +0100 |
---|---|---|
committer | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-08-11 11:12:49 +0100 |
commit | c3540e2b7aff0f4632e1ea82cd2cfd55b1b11ff4 (patch) | |
tree | f560f0242c4d15050fc45e36a6c8aaee24d9a077 /setup.py | |
parent | f14172902b9c21f4ed47a35ce467727f02867280 (diff) | |
download | brotli-c3540e2b7aff0f4632e1ea82cd2cfd55b1b11ff4.zip brotli-c3540e2b7aff0f4632e1ea82cd2cfd55b1b11ff4.tar.gz brotli-c3540e2b7aff0f4632e1ea82cd2cfd55b1b11ff4.tar.bz2 |
[setup.py] use MSVC 10.0 when compiling for Windows Python 2.7
Python 2.7 for Windows is compiled using MS Visaul C++ 9.0 (Visual Studio 2008).
However the latter does not support many modern C++ features which are
required to compile the Brotli encoder. So we monkey-patch distutils
to always look for MSVC version 10.0 instead of 9.0.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,9 +1,24 @@ +import distutils from distutils.core import setup, Extension from distutils.command.build_ext import build_ext from distutils.cmd import Command import platform +# when compiling for Windows Python 2.7, force distutils to use Visual Studio +# 2010 instead of 2008, as the latter doesn't support c++0x +if platform.system() == 'Windows': + try: + import distutils.msvc9compiler + except distutils.errors.DistutilsPlatformError: + pass # importing msvc9compiler raises when running under MinGW + else: + orig_find_vcvarsall = distutils.msvc9compiler.find_vcvarsall + def patched_find_vcvarsall(version): + return orig_find_vcvarsall(version if version != 9.0 else 10.0) + distutils.msvc9compiler.find_vcvarsall = patched_find_vcvarsall + + class TestCommand(Command): """ Run all *_test.py scripts in 'tests' folder with the same Python interpreter used to run setup.py. |