Skip to content

Commit 76ef774

Browse files
committed
Merge pull request #121 from denfromufa/develop
Update setup.py
2 parents 20e1d37 + 641eeba commit 76ef774

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

setup.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Setup script for building clr.pyd and dependencies using mono and into
33
an egg or wheel.
44
"""
5+
56
from setuptools import setup, Extension
67
from distutils.command.build_ext import build_ext
78
from distutils.command.install_lib import install_lib
@@ -28,6 +29,18 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
2829
import winreg as _winreg
2930

3031
if use_windows_sdk:
32+
if sys.version_info[:2] == (2,7):
33+
locappdir = os.environ["LOCALAPPDATA"]
34+
vcpy27 = (r"Programs\Common\Microsoft"
35+
r"\Visual C++ for Python\9.0\WinSDK\Bin")
36+
if PLATFORM == "x86":
37+
mtpath = os.path.join(
38+
locappdir, vcpy27, r"mt.exe")
39+
elif PLATFORM == "x64":
40+
mtpath = os.path.join(
41+
locappdir, vcpy27, r"x64\mt.exe")
42+
if os.path.exists(mtpath):
43+
return mtpath
3144
value_name = "InstallationFolder"
3245
sdk_name = "Windows SDK"
3346
keys_to_check = [
@@ -41,6 +54,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
4154
value_name = "MSBuildToolsPath"
4255
sdk_name = "MSBuild"
4356
keys_to_check = [
57+
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0",
4458
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0",
4559
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0",
4660
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5",
@@ -148,7 +162,7 @@ def build_extension(self, ext):
148162
"/p:Configuration=%s" % _config,
149163
"/p:Platform=%s" % PLATFORM,
150164
"/p:DefineConstants=\"%s\"" % _defines_sep.join(defines),
151-
"/p:PythonBuildDir=%s" % os.path.abspath(dest_dir),
165+
"/p:PythonBuildDir=\"%s\"" % os.path.abspath(dest_dir),
152166
"/verbosity:%s" % VERBOSITY,
153167
]
154168

@@ -314,4 +328,3 @@ def _check_output(*popenargs, **kwargs):
314328
"install_data": PythonNET_InstallData,
315329
}
316330
)
317-

0 commit comments

Comments
 (0)