~inkscape.dev/inkscape-devlibs64/trunk

« back to all changes in this revision

Viewing changes to python/Lib/site-packages/numpy/distutils/msvc9compiler.py

  • Committer: Eduard Braun
  • Date: 2016-10-22 16:51:19 UTC
  • Revision ID: eduard.braun2@gmx.de-20161022165119-9eosgy6lp8j1kzli
Update Python to version 2.7.12

Included modules:
  coverage 4.2
  lxml 3.6.4
  numpy 1.11.2
  scour 0.35
  six 1.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import division, absolute_import, print_function
 
2
 
1
3
import os
2
 
import distutils.msvc9compiler
3
 
from distutils.msvc9compiler import *
4
 
 
5
 
 
6
 
class MSVCCompiler(distutils.msvc9compiler.MSVCCompiler):
 
4
from distutils.msvc9compiler import MSVCCompiler as _MSVCCompiler
 
5
 
 
6
 
 
7
def _merge(old, new):
 
8
    """Concatenate two environment paths avoiding repeats.
 
9
 
 
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.
 
16
 
 
17
    Parameters
 
18
    ----------
 
19
    old : string
 
20
        Previous enviroment string.
 
21
    new : string
 
22
        New environment string.
 
23
 
 
24
    Returns
 
25
    -------
 
26
    ret : string
 
27
        Updated environment string.
 
28
 
 
29
    """
 
30
    if new in old:
 
31
        return old
 
32
    if not old:
 
33
        return new
 
34
 
 
35
    # Neither new nor old is empty. Give old priority.
 
36
    return ';'.join([old, new])
 
37
 
 
38
 
 
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)
9
42
 
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)
 
49
 
 
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'])
 
53
 
 
54
        # msvc9 building for 32 bits requires SSE2 to work around a
 
55
        # compiler bug.
 
56
        if platform_bits == 32:
 
57
            self.compile_options += ['/arch:SSE2']
 
58
            self.compile_options_debug += ['/arch:SSE2']
18
59
 
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,
22
 
                                                                   output_filename,
23
 
                                                                   build_temp, ld_args)
 
62
        _MSVCCompiler.manifest_setup_ldargs(self, output_filename,
 
63
                                            build_temp, ld_args)