Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/setuptools/msvc9_support.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author | bcclaywell |
---|---|
date | Mon, 12 Oct 2015 17:43:33 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d67268158946 |
---|---|
1 try: | |
2 import distutils.msvc9compiler | |
3 except ImportError: | |
4 pass | |
5 | |
6 unpatched = dict() | |
7 | |
8 def patch_for_specialized_compiler(): | |
9 """ | |
10 Patch functions in distutils.msvc9compiler to use the standalone compiler | |
11 build for Python (Windows only). Fall back to original behavior when the | |
12 standalone compiler is not available. | |
13 """ | |
14 if 'distutils' not in globals(): | |
15 # The module isn't available to be patched | |
16 return | |
17 | |
18 if unpatched: | |
19 # Already patched | |
20 return | |
21 | |
22 unpatched.update(vars(distutils.msvc9compiler)) | |
23 | |
24 distutils.msvc9compiler.find_vcvarsall = find_vcvarsall | |
25 distutils.msvc9compiler.query_vcvarsall = query_vcvarsall | |
26 | |
27 def find_vcvarsall(version): | |
28 Reg = distutils.msvc9compiler.Reg | |
29 VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' | |
30 key = VC_BASE % ('', version) | |
31 try: | |
32 # Per-user installs register the compiler path here | |
33 productdir = Reg.get_value(key, "installdir") | |
34 except KeyError: | |
35 try: | |
36 # All-user installs on a 64-bit system register here | |
37 key = VC_BASE % ('Wow6432Node\\', version) | |
38 productdir = Reg.get_value(key, "installdir") | |
39 except KeyError: | |
40 productdir = None | |
41 | |
42 if productdir: | |
43 import os | |
44 vcvarsall = os.path.join(productdir, "vcvarsall.bat") | |
45 if os.path.isfile(vcvarsall): | |
46 return vcvarsall | |
47 | |
48 return unpatched['find_vcvarsall'](version) | |
49 | |
50 def query_vcvarsall(version, *args, **kwargs): | |
51 try: | |
52 return unpatched['query_vcvarsall'](version, *args, **kwargs) | |
53 except distutils.errors.DistutilsPlatformError as exc: | |
54 if exc and "vcvarsall.bat" in exc.args[0]: | |
55 message = 'Microsoft Visual C++ %0.1f is required (%s).' % (version, exc.args[0]) | |
56 if int(version) == 9: | |
57 # This redirection link is maintained by Microsoft. | |
58 # Contact vspython@microsoft.com if it needs updating. | |
59 raise distutils.errors.DistutilsPlatformError( | |
60 message + ' Get it from http://aka.ms/vcpython27' | |
61 ) | |
62 raise distutils.errors.DistutilsPlatformError(message) | |
63 raise |