| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3f02c12 commit 78d5d46
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,9 @@ | |||
| 1 | 1 | version: '{branch}-{build}' | |
| 2 | 2 | build: off | |
| 3 | 3 | ||
| 4 | + image: | ||
| 5 | + - Visual Studio 2017 | ||
| 6 | + | ||
| 4 | 7 | platform: | |
| 5 | 8 | - x86 | |
| 6 | 9 | - x64 | |
@@ -17,6 +20,16 @@ environment: | |||
| 17 | 20 | - PYTHON_VERSION: 3.4 | |
| 18 | 21 | - PYTHON_VERSION: 3.5 | |
| 19 | 22 | - PYTHON_VERSION: 3.6 | |
| 23 | + - PYTHON_VERSION: 2.7 | ||
| 24 | + BUILD_OPTS:--xplat | ||
| 25 | + - PYTHON_VERSION: 3.3 | ||
| 26 | + BUILD_OPTS:--xplat | ||
| 27 | + - PYTHON_VERSION: 3.4 | ||
| 28 | + BUILD_OPTS:--xplat | ||
| 29 | + - PYTHON_VERSION: 3.5 | ||
| 30 | + BUILD_OPTS:--xplat | ||
| 31 | + - PYTHON_VERSION: 3.6 | ||
| 32 | + BUILD_OPTS:--xplat | ||
| 20 | 33 | ||
| 21 | 34 | init: | |
| 22 | 35 | # Update Environment Variables based on matrix/platform | |
@@ -29,6 +42,7 @@ init: | |||
| 29 | 42 | ||
| 30 | 43 | install: | |
| 31 | 44 | - pip install --upgrade -r requirements.txt --quiet | |
| 45 | + - choco install vswhere -y | ||
| 32 | 46 | ||
| 33 | 47 | # Install OpenCover. Can't put on `packages.config`, not Mono compatible | |
| 34 | 48 | - .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet | |
@@ -37,7 +51,7 @@ build_script: | |||
| 37 | 51 | # Create clean `sdist`. Only used for releases | |
| 38 | 52 | - python setup.py --quiet sdist | |
| 39 | 53 | # Build `wheel` with coverage of `setup.py` | |
| 40 | - - coverage run setup.py bdist_wheel | ||
| 54 | + - coverage run setup.py bdist_wheel %BUILD_OPTS% | ||
| 41 | 55 | ||
| 42 | 56 | test_script: | |
| 43 | 57 | - pip install --no-index --find-links=.\dist\ pythonnet | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,12 @@ if ($FALSE -and $env:PLATFORM -eq "x86"){ | |||
| 11 | 11 | # Executable paths for OpenCover | |
| 12 | 12 | # Note if OpenCover fails, it won't affect the exit codes. | |
| 13 | 13 | $OPENCOVER = Resolve-Path .\packages\OpenCover.*\tools\OpenCover.Console.exe | |
| 14 | - $CS_RUNNER = Resolve-Path .\packages\NUnit.*\tools\"$CS_RUNNER".exe | ||
| 14 | + if ($env:BUILD_OPTS -eq "--xplat"){ | ||
| 15 | + $CS_RUNNER = Resolve-Path $env:USERPROFILE\.nuget\packages\nunit.consolerunner\*\tools\"$CS_RUNNER".exe | ||
| 16 | + } | ||
| 17 | + else{ | ||
| 18 | + $CS_RUNNER = Resolve-Path .\packages\NUnit.*\tools\"$CS_RUNNER".exe | ||
| 19 | + } | ||
| 15 | 20 | $PY = Get-Command python | |
| 16 | 21 | ||
| 17 | 22 | # Can't use ".\build\*\Python.EmbeddingTest.dll". Missing framework files. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ | |||
| 15 | 15 | import sysconfig | |
| 16 | 16 | from distutils import spawn | |
| 17 | 17 | from distutils.command import install, build, build_ext, install_data, install_lib | |
| 18 | + from wheel import bdist_wheel | ||
| 18 | 19 | ||
| 19 | 20 | from setuptools import Extension, setup | |
| 20 | 21 | ||
@@ -139,14 +140,14 @@ def _update_xlat_devtools(): | |||
| 139 | 140 | DEVTOOLS = "dotnet" | |
| 140 | 141 | ||
| 141 | 142 | class BuildExtPythonnet(build_ext.build_ext): | |
| 142 | - user_options = build_ext.build_ext.user_options + [ | ||
| 143 | - ('xplat', None, None) | ||
| 143 | + user_options = build_ext.build_ext.user_options + [ | ||
| 144 | + ('xplat', None, None) | ||
| 144 | 145 | ] | |
| 145 | - def initialize_options(self): | ||
| 146 | - build_ext.build_ext.initialize_options(self) | ||
| 147 | - self.xplat = None | ||
| 148 | - | ||
| 149 | - def finalize_options(self): | ||
| 146 | + def initialize_options(self): | ||
| 147 | + build_ext.build_ext.initialize_options(self) | ||
| 148 | + self.xplat = None | ||
| 149 | + | ||
| 150 | + def finalize_options(self): | ||
| 150 | 151 | build_ext.build_ext.finalize_options(self) | |
| 151 | 152 | ||
| 152 | 153 | def build_extension(self, ext): | |
@@ -218,8 +219,7 @@ def build_extension(self, ext): | |||
| 218 | 219 | _solution_file = 'pythonnet.sln' | |
| 219 | 220 | _custom_define_constants = False | |
| 220 | 221 | elif DEVTOOLS == "MsDev15": | |
| 221 | - # Improve this with self._find_msbuild_tool_15 to find good >15.3 msbuild, currently only works under VS 15.3 developer environment. | ||
| 222 | - _xbuild = '"{0}"'.format(self._find_msbuild_tool("msbuild.exe")) | ||
| 222 | + _xbuild = '"{0}"'.format(self._find_msbuild_tool_15()) | ||
| 223 | 223 | _config = "{0}Win".format(CONFIG) | |
| 224 | 224 | _solution_file = 'pythonnet.15.sln' | |
| 225 | 225 | _custom_define_constants = True | |
@@ -364,6 +364,20 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): | |||
| 364 | 364 | ||
| 365 | 365 | raise RuntimeError("{0} could not be found".format(tool)) | |
| 366 | 366 | ||
| 367 | + def _find_msbuild_tool_15(self): | ||
| 368 | + """Return full path to one of the Microsoft build tools""" | ||
| 369 | + try: | ||
| 370 | + basePathes = subprocess.check_output( | ||
| 371 | + ["vswhere", "-latest", | ||
| 372 | + "-version", "[15.0, 16.0)", | ||
| 373 | + "-requires", "Microsoft.Component.MSBuild", | ||
| 374 | + "-property", "InstallationPath"]).splitlines() | ||
| 375 | + if len(basePathes): | ||
| 376 | + return os.path.join(basePathes[0].decode(sys.stdout.encoding or "utf-8"), "MSBuild", "15.0", "Bin", "MSBuild.exe") | ||
| 377 | + else: | ||
| 378 | + raise RuntimeError("MSBuild >=15.0 could not be found.") | ||
| 379 | + except subprocess.CalledProcessError as e: | ||
| 380 | + raise RuntimeError("MSBuild >=15.0 could not be found. {0}".format(e.output)) | ||
| 367 | 381 | ||
| 368 | 382 | class InstallLibPythonnet(install_lib.install_lib): | |
| 369 | 383 | def install(self): | |
@@ -417,7 +431,23 @@ def run(self): | |||
| 417 | 431 | _update_xlat_devtools() | |
| 418 | 432 | return install.install.run(self) | |
| 419 | 433 | ||
| 420 | - ############################################################################### | ||
| 434 | + class BDistWheelPythonnet(bdist_wheel.bdist_wheel): | ||
| 435 | + user_options = bdist_wheel.bdist_wheel.user_options + [ | ||
| 436 | + ('xplat', None, None) | ||
| 437 | + ] | ||
| 438 | + def initialize_options(self): | ||
| 439 | + bdist_wheel.bdist_wheel.initialize_options(self) | ||
| 440 | + self.xplat = None | ||
| 441 | + | ||
| 442 | + def finalize_options(self): | ||
| 443 | + bdist_wheel.bdist_wheel.finalize_options(self) | ||
| 444 | + | ||
| 445 | + def run(self): | ||
| 446 | + if self.xplat: | ||
| 447 | + _update_xlat_devtools() | ||
| 448 | + return bdist_wheel.bdist_wheel.run(self) | ||
| 449 | + | ||
| 450 | + ############################################################################### | ||
| 421 | 451 | setupdir = os.path.dirname(__file__) | |
| 422 | 452 | if setupdir: | |
| 423 | 453 | os.chdir(setupdir) | |
@@ -449,6 +479,7 @@ def run(self): | |||
| 449 | 479 | "build_ext": BuildExtPythonnet, | |
| 450 | 480 | "install_lib": InstallLibPythonnet, | |
| 451 | 481 | "install_data": InstallDataPythonnet, | |
| 482 | + "bdist_wheel": BDistWheelPythonnet | ||
| 452 | 483 | }, | |
| 453 | 484 | classifiers=[ | |
| 454 | 485 | 'Development Status :: 5 - Production/Stable', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments