|
19 | 19 | - VS 2010, 64 bit -- Windows SDK v7.1 |
20 | 20 | """ |
21 | 21 |
|
22 | | -import sys |
23 | 22 | import platform |
24 | | -import os |
25 | | -import glob |
26 | | -import shutil |
27 | | -import zipfile |
28 | | -import tarfile |
29 | 23 | import distutils.msvc9compiler as msvc |
30 | 24 |
|
31 | | -def fixproj(project_file, bit_target): |
32 | | - """ |
33 | | - :param bit_target: one of 'Win32' or 'x64' |
34 | | - """ |
35 | | - with open(project_file, 'r') as fd: |
36 | | - content = '\n'.join(line.strip() for line in fd if line.strip()) |
37 | | - content = content.replace('Win32', bit_target).replace('x64', bit_target) |
38 | | - with open(project_file, 'w') as fd: |
39 | | - fd.write(content) |
40 | | - |
41 | | -def tar_extract(tar_file, target): |
42 | | - with tarfile.open(tar_file, 'r:gz') as tgz: |
43 | | - tgz.extractall(target) |
44 | | - |
45 | | -def zip_extract(zip_file, target): |
46 | | - with zipfile.ZipFile(zip_file) as zf: |
47 | | - zf.extractall(target) |
48 | | - |
49 | 25 | # Configuration selection & declaration: |
50 | | -DEPSSRC = os.path.join(os.path.dirname(os.path.normpath(__file__)), |
51 | | - 'deps_source') |
52 | | -DEPSBUILD = os.path.join(os.path.dirname(os.path.normpath(__file__)), 'build') |
53 | 26 | X64 = platform.architecture()[0] == '64bit' |
54 | | -PYVER = sys.version_info[:2] |
55 | | -VS2010 = PYVER >= (3, 3) |
56 | 27 | xXX = 'x64' if X64 else 'x86' |
57 | | -# If not VS2010, then use VS2008 |
58 | | - |
59 | | -VCVARSALL = None |
60 | 28 |
|
61 | 29 | def prepare_build_cmd(build_cmd, **kwargs): |
62 | | - global VCVARSALL |
| 30 | + VCVARSALL = msvc.find_vcvarsall(10.0) |
63 | 31 | if VCVARSALL == None: |
64 | | - candidate = msvc.find_vcvarsall(10.0 if VS2010 else 9.0) |
65 | | - if candidate == None: |
66 | | - raise RuntimeError('Microsoft VS {} required' |
67 | | - .format('2010' if VS2010 else '2008')) |
68 | | - else: |
69 | | - VCVARSALL = candidate |
70 | | - |
71 | | - return build_cmd.format( |
72 | | - vcvarsall=VCVARSALL, xXX=xXX, **kwargs) |
| 32 | + raise RuntimeError('Microsoft VS 2010 required') |
| 33 | + return build_cmd.format(vcvarsall=VCVARSALL, xXX=xXX, **kwargs) |
0 commit comments