Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f6e7b9

Browse filesBrowse files
committed
More simplifications to FreeType setup on Windows.
- VS2010 is now always True -> perform constant folding. - Remove unused fixproj, tar_extract, zip_extract, DEPSSRC, DEPSBUILD, PYVER. - prepare_build_cmd is only called once so no need to cache VCVARSALL. - Remove unused imports.
1 parent 2afeec7 commit 3f6e7b9
Copy full SHA for 3f6e7b9

File tree

Expand file treeCollapse file tree

2 files changed

+5
-48
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-48
lines changed

‎setup_external_compile.py

Copy file name to clipboardExpand all lines: setup_external_compile.py
+3-42Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,15 @@
1919
- VS 2010, 64 bit -- Windows SDK v7.1
2020
"""
2121

22-
import sys
2322
import platform
24-
import os
25-
import glob
26-
import shutil
27-
import zipfile
28-
import tarfile
2923
import distutils.msvc9compiler as msvc
3024

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-
4925
# 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')
5326
X64 = platform.architecture()[0] == '64bit'
54-
PYVER = sys.version_info[:2]
55-
VS2010 = PYVER >= (3, 3)
5627
xXX = 'x64' if X64 else 'x86'
57-
# If not VS2010, then use VS2008
58-
59-
VCVARSALL = None
6028

6129
def prepare_build_cmd(build_cmd, **kwargs):
62-
global VCVARSALL
30+
VCVARSALL = msvc.find_vcvarsall(10.0)
6331
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)

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,17 +1134,13 @@ def do_custom_build(self):
11341134
"""
11351135
from setup_external_compile import fixproj, prepare_build_cmd, VS2010, X64, xXX
11361136
# Note: freetype has no build profile for 2014, so we don't bother...
1137-
vc = 'vc2010' if VS2010 else 'vc2008'
1137+
vc = 'vc2010'
11381138
WinXX = 'x64' if X64 else 'Win32'
1139-
# This is only false for py2.7, even on py3.5...
1140-
if not VS2010:
1141-
fixproj(os.path.join(src_path, 'builds', 'windows', vc, 'freetype.sln'), WinXX)
1142-
fixproj(os.path.join(src_path, 'builds', 'windows', vc, 'freetype.vcproj'), WinXX)
11431139

11441140
cmdfile = os.path.join("build", "build_freetype.cmd")
11451141
with open(cmdfile, 'w') as cmd:
11461142
cmd.write(prepare_build_cmd(FREETYPE_BUILD_CMD, vc20xx=vc, WinXX=WinXX,
1147-
config='Release' if VS2010 else 'LIB Release'))
1143+
config='Release'))
11481144

11491145
shutil.rmtree(str(Path(src_path, "objs")), ignore_errors=True)
11501146
subprocess.check_call([os.path.abspath(cmdfile)],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.