Skip to content

Update setup.py #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Setup script for building clr.pyd and dependencies using mono and into
an egg or wheel.
"""

from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.command.install_lib import install_lib
Expand All @@ -28,6 +29,18 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
import winreg as _winreg

if use_windows_sdk:
if sys.version_info[:2] == (2,7):
locappdir = os.environ["LOCALAPPDATA"]
vcpy27 = (r"Programs\Common\Microsoft"
r"\Visual C++ for Python\9.0\WinSDK\Bin")
if PLATFORM == "x86":
mtpath = os.path.join(
locappdir, vcpy27, r"mt.exe")
elif PLATFORM == "x64":
mtpath = os.path.join(
locappdir, vcpy27, r"x64\mt.exe")
if os.path.exists(mtpath):
return mtpath
value_name = "InstallationFolder"
sdk_name = "Windows SDK"
keys_to_check = [
Expand All @@ -41,6 +54,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
value_name = "MSBuildToolsPath"
sdk_name = "MSBuild"
keys_to_check = [
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0",
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0",
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0",
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5",
Expand Down Expand Up @@ -148,7 +162,7 @@ def build_extension(self, ext):
"/p:Configuration=%s" % _config,
"/p:Platform=%s" % PLATFORM,
"/p:DefineConstants=\"%s\"" % _defines_sep.join(defines),
"/p:PythonBuildDir=%s" % os.path.abspath(dest_dir),
"/p:PythonBuildDir=\"%s\"" % os.path.abspath(dest_dir),
"/verbosity:%s" % VERBOSITY,
]

Expand Down Expand Up @@ -314,4 +328,3 @@ def _check_output(*popenargs, **kwargs):
"install_data": PythonNET_InstallData,
}
)