Skip to content

Commit b71fd6a

Browse files
committed
Inline setup_external_compile into setupext.
1 parent 7544c46 commit b71fd6a

File tree

3 files changed

+12
-45
lines changed

3 files changed

+12
-45
lines changed

pytest.ini

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pep8ignore =
1212

1313
setup.py E402
1414
setupext.py E301 E302 E501
15-
setup_external_compile.py E302 E711
1615

1716
versioneer.py ALL # External file.
1817
tools/gh_api.py ALL # External file.

setup_external_compile.py

-33
This file was deleted.

setupext.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -1124,26 +1124,27 @@ def do_custom_build(self):
11241124
subprocess.check_call(["make"], env=env, cwd=src_path)
11251125
else:
11261126
# compilation on windows
1127+
shutil.rmtree(str(Path(src_path, "objs")), ignore_errors=True)
11271128
FREETYPE_BUILD_CMD = r"""
11281129
call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
11291130
/Release /{xXX} /xp
11301131
call "{vcvarsall}" {xXX}
11311132
set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
11321133
%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
1133-
/t:Clean;Build /p:Configuration="{config}";Platform={WinXX}
1134+
/t:Clean;Build /p:Configuration="Release";Platform={WinXX}
11341135
"""
1135-
from setup_external_compile import prepare_build_cmd, X64, xXX
1136+
import distutils.msvc9compiler as msvc
11361137
# Note: freetype has no build profile for 2014, so we don't bother...
11371138
vc = 'vc2010'
1138-
WinXX = 'x64' if X64 else 'Win32'
1139-
1140-
cmdfile = os.path.join("build", "build_freetype.cmd")
1141-
with open(cmdfile, 'w') as cmd:
1142-
cmd.write(prepare_build_cmd(FREETYPE_BUILD_CMD, vc20xx=vc, WinXX=WinXX,
1143-
config='Release'))
1144-
1145-
shutil.rmtree(str(Path(src_path, "objs")), ignore_errors=True)
1146-
subprocess.check_call([os.path.abspath(cmdfile)],
1139+
WinXX = 'x64' if platform.architecture()[0] == '64bit' else 'Win32'
1140+
xXX = 'x64' if platform.architecture()[0] == '64bit' else 'x86'
1141+
vcvarsall = msvc.find_vcvarsall(10.0)
1142+
if vcvarsall is None:
1143+
raise RuntimeError('Microsoft VS 2010 required')
1144+
cmdfile = Path("build/build_freetype.cmd")
1145+
cmdfile.write_text(FREETYPE_BUILD_CMD.format(
1146+
vc20xx=vc, WinXX=WinXX, xXX=xXX, vcvarsall=vcvarsall))
1147+
subprocess.check_call([str(cmdfile.resolve())],
11471148
shell=True, cwd=src_path)
11481149
# Move to the corresponding Unix build path.
11491150
Path(src_path, "objs/.libs").mkdir()

0 commit comments

Comments
 (0)