1
from __future__ import division, absolute_import, print_function
2
import distutils.msvc9compiler
3
from distutils.msvc9compiler import *
6
class MSVCCompiler(distutils.msvc9compiler.MSVCCompiler):
4
from distutils.msvc9compiler import MSVCCompiler as _MSVCCompiler
8
"""Concatenate two environment paths avoiding repeats.
10
Here `old` is the environment string before the base class initialize
11
function is called and `new` is the string after the call. The new string
12
will be a fixed string if it is not obtained from the current enviroment,
13
or the same as the old string if obtained from the same enviroment. The aim
14
here is not to append the new string if it is already contained in the old
15
string so as to limit the growth of the environment string.
20
Previous enviroment string.
22
New environment string.
27
Updated environment string.
35
# Neither new nor old is empty. Give old priority.
36
return ';'.join([old, new])
39
class MSVCCompiler(_MSVCCompiler):
7
40
def __init__(self, verbose=0, dry_run=0, force=0):
8
distutils.msvc9compiler.MSVCCompiler.__init__(self, verbose, dry_run, force)
41
_MSVCCompiler.__init__(self, verbose, dry_run, force)
10
43
def initialize(self, plat_name=None):
44
# The 'lib' and 'include' variables may be overwritten
45
# by MSVCCompiler.initialize, so save them for later merge.
11
46
environ_lib = os.getenv('lib')
12
47
environ_include = os.getenv('include')
13
distutils.msvc9compiler.MSVCCompiler.initialize(self, plat_name)
14
if environ_lib is not None:
15
os.environ['lib'] = environ_lib + os.environ['lib']
16
if environ_include is not None:
17
os.environ['include'] = environ_include + os.environ['include']
48
_MSVCCompiler.initialize(self, plat_name)
50
# Merge current and previous values of 'lib' and 'include'
51
os.environ['lib'] = _merge(environ_lib, os.environ['lib'])
52
os.environ['include'] = _merge(environ_include, os.environ['include'])
54
# msvc9 building for 32 bits requires SSE2 to work around a
56
if platform_bits == 32:
57
self.compile_options += ['/arch:SSE2']
58
self.compile_options_debug += ['/arch:SSE2']
19
60
def manifest_setup_ldargs(self, output_filename, build_temp, ld_args):
20
61
ld_args.append('/MANIFEST')
21
distutils.msvc9compiler.MSVCCompiler.manifest_setup_ldargs(self,
62
_MSVCCompiler.manifest_setup_ldargs(self, output_filename,