| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8b0b399 commit 3f02c12
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,18 +1,145 @@ | |||
| 1 | + dist: trusty | ||
| 1 | 2 | sudo: false | |
| 2 | - | ||
| 3 | 3 | language: python | |
| 4 | - python: | ||
| 5 | - - 2.7 | ||
| 6 | - - 3.3 | ||
| 7 | - - 3.4 | ||
| 8 | - - 3.5 | ||
| 9 | - - 3.6 | ||
| 10 | - - 3.7-dev | ||
| 11 | - | ||
| 4 | + | ||
| 12 | 5 | matrix: | |
| 13 | - allow_failures: | ||
| 14 | - - python: 3.7-dev | ||
| 6 | + include: | ||
| 7 | + - python: 2.7 | ||
| 8 | + env: | ||
| 9 | + - BUILD_OPTS= | ||
| 10 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 11 | + - python: 3.3 | ||
| 12 | + env: | ||
| 13 | + - BUILD_OPTS= | ||
| 14 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 15 | + - python: 3.4 | ||
| 16 | + env: | ||
| 17 | + - BUILD_OPTS= | ||
| 18 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 19 | + - python: 3.5 | ||
| 20 | + env: | ||
| 21 | + - BUILD_OPTS= | ||
| 22 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 23 | + - python: 3.6 | ||
| 24 | + env: | ||
| 25 | + - BUILD_OPTS= | ||
| 26 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 27 | + - python: "3.7-dev" | ||
| 28 | + env: | ||
| 29 | + - BUILD_OPTS= | ||
| 30 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 15 | 31 | ||
| 32 | + - python: 2.7 | ||
| 33 | + env: | ||
| 34 | + - BUILD_OPTS=--xplat | ||
| 35 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 36 | + addons: | ||
| 37 | + apt: | ||
| 38 | + sources: | ||
| 39 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 40 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 41 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 42 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 43 | + packages: | ||
| 44 | + - mono-devel | ||
| 45 | + - ca-certificates-mono | ||
| 46 | + - dotnet-hostfxr-2.0.0 | ||
| 47 | + - dotnet-runtime-2.0.0 | ||
| 48 | + - dotnet-sdk-2.0.0 | ||
| 49 | + - python: 3.3 | ||
| 50 | + env: | ||
| 51 | + - BUILD_OPTS=--xplat | ||
| 52 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 53 | + addons: | ||
| 54 | + apt: | ||
| 55 | + sources: | ||
| 56 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 57 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 58 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 59 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 60 | + packages: | ||
| 61 | + - mono-devel | ||
| 62 | + - ca-certificates-mono | ||
| 63 | + - dotnet-hostfxr-2.0.0 | ||
| 64 | + - dotnet-runtime-2.0.0 | ||
| 65 | + - dotnet-sdk-2.0.0 | ||
| 66 | + - python: 3.4 | ||
| 67 | + env: | ||
| 68 | + - BUILD_OPTS=--xplat | ||
| 69 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 70 | + addons: | ||
| 71 | + apt: | ||
| 72 | + sources: | ||
| 73 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 74 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 75 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 76 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 77 | + packages: | ||
| 78 | + - mono-devel | ||
| 79 | + - ca-certificates-mono | ||
| 80 | + - dotnet-hostfxr-2.0.0 | ||
| 81 | + - dotnet-runtime-2.0.0 | ||
| 82 | + - dotnet-sdk-2.0.0 | ||
| 83 | + - python: 3.5 | ||
| 84 | + env: | ||
| 85 | + - BUILD_OPTS=--xplat | ||
| 86 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 87 | + addons: | ||
| 88 | + apt: | ||
| 89 | + sources: | ||
| 90 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 91 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 92 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 93 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 94 | + packages: | ||
| 95 | + - mono-devel | ||
| 96 | + - ca-certificates-mono | ||
| 97 | + - dotnet-hostfxr-2.0.0 | ||
| 98 | + - dotnet-runtime-2.0.0 | ||
| 99 | + - dotnet-sdk-2.0.0 | ||
| 100 | + - python: 3.6 | ||
| 101 | + env: | ||
| 102 | + - BUILD_OPTS=--xplat | ||
| 103 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 104 | + addons: | ||
| 105 | + apt: | ||
| 106 | + sources: | ||
| 107 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 108 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 109 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 110 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 111 | + packages: | ||
| 112 | + - mono-devel | ||
| 113 | + - ca-certificates-mono | ||
| 114 | + - dotnet-hostfxr-2.0.0 | ||
| 115 | + - dotnet-runtime-2.0.0 | ||
| 116 | + - dotnet-sdk-2.0.0 | ||
| 117 | + - python: "3.7-dev" | ||
| 118 | + env: | ||
| 119 | + - BUILD_OPTS=--xplat | ||
| 120 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 121 | + addons: | ||
| 122 | + apt: | ||
| 123 | + sources: | ||
| 124 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 125 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 126 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 127 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 128 | + packages: | ||
| 129 | + - mono-devel | ||
| 130 | + - ca-certificates-mono | ||
| 131 | + - dotnet-hostfxr-2.0.0 | ||
| 132 | + - dotnet-runtime-2.0.0 | ||
| 133 | + - dotnet-sdk-2.0.0 | ||
| 134 | + allow_failures: | ||
| 135 | + - python: "3.7-dev" | ||
| 136 | + env: | ||
| 137 | + - BUILD_OPTS= | ||
| 138 | + - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 139 | + - python: "3.7-dev" | ||
| 140 | + env: | ||
| 141 | + - BUILD_OPTS=--xplat | ||
| 142 | + - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 16 | 143 | env: | |
| 17 | 144 | global: | |
| 18 | 145 | - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so | |
@@ -23,8 +150,8 @@ env: | |||
| 23 | 150 | addons: | |
| 24 | 151 | apt: | |
| 25 | 152 | sources: | |
| 26 | - - mono | ||
| 27 | - - mono-libtiff-compat | ||
| 153 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 154 | + key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 28 | 155 | packages: | |
| 29 | 156 | - mono-devel | |
| 30 | 157 | - ca-certificates-mono | |
@@ -37,11 +164,11 @@ before_install: | |||
| 37 | 164 | install: | |
| 38 | 165 | - pip install --upgrade setuptools # TEMP - due to setuptools 36.2.0 bug | |
| 39 | 166 | - pip install --upgrade -r requirements.txt | |
| 40 | - - coverage run setup.py install | ||
| 167 | + - coverage run setup.py install $BUILD_OPTS | ||
| 41 | 168 | ||
| 42 | 169 | script: | |
| 43 | 170 | - python -m pytest | |
| 44 | - - mono ./packages/NUnit.*/tools/nunit3-console.exe src/embed_tests/bin/Python.EmbeddingTest.dll | ||
| 171 | + - mono $NUNIT_PATH src/embed_tests/bin/Python.EmbeddingTest.dll | ||
| 45 | 172 | ||
| 46 | 173 | after_script: | |
| 47 | 174 | # Uncomment if need to geninterop, ie. py37 final | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ | |||
| 14 | 14 | import sys | |
| 15 | 15 | import sysconfig | |
| 16 | 16 | from distutils import spawn | |
| 17 | - from distutils.command import build_ext, install_data, install_lib | ||
| 17 | + from distutils.command import install, build, build_ext, install_data, install_lib | ||
| 18 | 18 | ||
| 19 | 19 | from setuptools import Extension, setup | |
| 20 | 20 | ||
@@ -131,6 +131,12 @@ def _get_long_description(): | |||
| 131 | 131 | except ImportError: | |
| 132 | 132 | return '.Net and Mono integration for Python' | |
| 133 | 133 | ||
| 134 | + def _update_xlat_devtools(): | ||
| 135 | + global DEVTOOLS | ||
| 136 | + if DEVTOOLS == "MsDev": | ||
| 137 | + DEVTOOLS = "MsDev15" | ||
| 138 | + elif DEVTOOLS == "Mono": | ||
| 139 | + DEVTOOLS = "dotnet" | ||
| 134 | 140 | ||
| 135 | 141 | class BuildExtPythonnet(build_ext.build_ext): | |
| 136 | 142 | user_options = build_ext.build_ext.user_options + [ | |
@@ -144,6 +150,9 @@ def finalize_options(self): | |||
| 144 | 150 | build_ext.build_ext.finalize_options(self) | |
| 145 | 151 | ||
| 146 | 152 | def build_extension(self, ext): | |
| 153 | + if self.xplat: | ||
| 154 | + _update_xlat_devtools() | ||
| 155 | + | ||
| 147 | 156 | """Builds the .pyd file using msbuild or xbuild""" | |
| 148 | 157 | if ext.name != "clr": | |
| 149 | 158 | return build_ext.build_ext.build_extension(self, ext) | |
@@ -174,7 +183,7 @@ def build_extension(self, ext): | |||
| 174 | 183 | if CONFIG == "Debug": | |
| 175 | 184 | defines.extend(["DEBUG", "TRACE"]) | |
| 176 | 185 | ||
| 177 | - if sys.platform != "win32" and DEVTOOLS == "Mono": | ||
| 186 | + if sys.platform != "win32" and (DEVTOOLS == "Mono" or DEVTOOLS == "dotnet"): | ||
| 178 | 187 | on_darwin = sys.platform == "darwin" | |
| 179 | 188 | defines.append("MONO_OSX" if on_darwin else "MONO_LINUX") | |
| 180 | 189 | ||
@@ -206,20 +215,34 @@ def build_extension(self, ext): | |||
| 206 | 215 | if DEVTOOLS == "MsDev": | |
| 207 | 216 | _xbuild = '"{0}"'.format(self._find_msbuild_tool("msbuild.exe")) | |
| 208 | 217 | _config = "{0}Win".format(CONFIG) | |
| 209 | - | ||
| 218 | + _solution_file = 'pythonnet.sln' | ||
| 219 | + _custom_define_constants = False | ||
| 220 | + 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")) | ||
| 223 | + _config = "{0}Win".format(CONFIG) | ||
| 224 | + _solution_file = 'pythonnet.15.sln' | ||
| 225 | + _custom_define_constants = True | ||
| 210 | 226 | elif DEVTOOLS == "Mono": | |
| 211 | - _xbuild = 'dotnet msbuild' if self.xplat else 'xbuild' | ||
| 227 | + _xbuild = 'xbuild' | ||
| 212 | 228 | _config = "{0}Mono".format(CONFIG) | |
| 229 | + _solution_file = 'pythonnet.sln' | ||
| 230 | + _custom_define_constants = False | ||
| 231 | + elif DEVTOOLS == "dotnet": | ||
| 232 | + _xbuild = 'dotnet msbuild' | ||
| 233 | + _config = "{0}Mono".format(CONFIG) | ||
| 234 | + _solution_file = 'pythonnet.15.sln' | ||
| 235 | + _custom_define_constants = True | ||
| 213 | 236 | else: | |
| 214 | 237 | raise NotImplementedError( | |
| 215 | - "DevTool {0} not supported (use MsDev/Mono)".format(DEVTOOLS)) | ||
| 238 | + "DevTool {0} not supported (use MsDev/MsDev15/Mono/dotnet)".format(DEVTOOLS)) | ||
| 216 | 239 | ||
| 217 | 240 | cmd = [ | |
| 218 | 241 | _xbuild, | |
| 219 | - 'pythonnet.15.sln' if self.xplat else 'pythonnet.sln', | ||
| 242 | + _solution_file, | ||
| 220 | 243 | '/p:Configuration={}'.format(_config), | |
| 221 | 244 | '/p:Platform={}'.format(ARCH), | |
| 222 | - '/p:{}DefineConstants="{}"'.format('Custom' if self.xplat else '','%3B'.join(defines)), | ||
| 245 | + '/p:{}DefineConstants="{}"'.format('Custom' if _custom_define_constants else '','%3B'.join(defines)), | ||
| 223 | 246 | '/p:PythonBuildDir="{}"'.format(os.path.abspath(dest_dir)), | |
| 224 | 247 | '/p:PythonInteropFile="{}"'.format(os.path.basename(interop_file)), | |
| 225 | 248 | '/verbosity:{}'.format(VERBOSITY), | |
@@ -230,16 +253,16 @@ def build_extension(self, ext): | |||
| 230 | 253 | cmd.append('/p:PythonManifest="{0}"'.format(manifest)) | |
| 231 | 254 | ||
| 232 | 255 | self.debug_print("Building: {0}".format(" ".join(cmd))) | |
| 233 | - use_shell = True if DEVTOOLS == "Mono" else False | ||
| 256 | + use_shell = True if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" else False | ||
| 234 | 257 | ||
| 235 | 258 | subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell) | |
| 236 | 259 | subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell) | |
| 237 | 260 | ||
| 238 | - if DEVTOOLS == "Mono": | ||
| 261 | + if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet": | ||
| 239 | 262 | self._build_monoclr() | |
| 240 | 263 | ||
| 241 | 264 | def _get_manifest(self, build_dir): | |
| 242 | - if DEVTOOLS != "MsDev": | ||
| 265 | + if DEVTOOLS != "MsDev" and DEVTOOLS != "MsDev15": | ||
| 243 | 266 | return | |
| 244 | 267 | mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True) | |
| 245 | 268 | manifest = os.path.abspath(os.path.join(build_dir, "app.manifest")) | |
@@ -272,33 +295,30 @@ def _build_monoclr(self): | |||
| 272 | 295 | ||
| 273 | 296 | def _install_packages(self): | |
| 274 | 297 | """install packages using nuget""" | |
| 275 | - nuget = os.path.join("tools", "nuget", "nuget.exe") | ||
| 276 | - use_shell = False | ||
| 277 | - if DEVTOOLS == "Mono": | ||
| 278 | - nuget = "mono {0}".format(nuget) | ||
| 279 | - use_shell = True | ||
| 298 | + use_shell = DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" | ||
| 280 | 299 | ||
| 281 | - if self.xplat: | ||
| 282 | - if DEVTOOLS == "MsDev": | ||
| 300 | + if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet": | ||
| 301 | + if DEVTOOLS == "MsDev15": | ||
| 283 | 302 | _config = "{0}Win".format(CONFIG) | |
| 284 | - elif DEVTOOLS == "Mono": | ||
| 303 | + elif DEVTOOLS == "dotnet": | ||
| 285 | 304 | _config = "{0}Mono".format(CONFIG) | |
| 286 | - else: | ||
| 287 | - raise NotImplementedError( | ||
| 288 | - "DevTool {0} not supported (use MsDev/Mono)".format(DEVTOOLS)) | ||
| 289 | 305 | ||
| 290 | 306 | cmd = "dotnet msbuild /t:Restore pythonnet.15.sln /p:Configuration={0} /p:Platform={1}".format(_config, ARCH) | |
| 291 | 307 | self.debug_print("Updating packages with xplat: {0}".format(cmd)) | |
| 292 | 308 | subprocess.check_call(cmd, shell=use_shell) | |
| 293 | - return; | ||
| 309 | + else: | ||
| 310 | + nuget = os.path.join("tools", "nuget", "nuget.exe") | ||
| 294 | 311 | ||
| 295 | - cmd = "{0} update -self".format(nuget) | ||
| 296 | - self.debug_print("Updating NuGet: {0}".format(cmd)) | ||
| 297 | - subprocess.check_call(cmd, shell=use_shell) | ||
| 312 | + if DEVTOOLS == "Mono": | ||
| 313 | + nuget = "mono {0}".format(nuget) | ||
| 298 | 314 | ||
| 299 | - cmd = "{0} restore pythonnet.sln -o packages".format(nuget) | ||
| 300 | - self.debug_print("Installing packages: {0}".format(cmd)) | ||
| 301 | - subprocess.check_call(cmd, shell=use_shell) | ||
| 315 | + cmd = "{0} update -self".format(nuget) | ||
| 316 | + self.debug_print("Updating NuGet: {0}".format(cmd)) | ||
| 317 | + subprocess.check_call(cmd, shell=use_shell) | ||
| 318 | + | ||
| 319 | + cmd = "{0} restore pythonnet.sln -o packages".format(nuget) | ||
| 320 | + self.debug_print("Installing packages: {0}".format(cmd)) | ||
| 321 | + subprocess.check_call(cmd, shell=use_shell) | ||
| 302 | 322 | ||
| 303 | 323 | def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): | |
| 304 | 324 | """Return full path to one of the Microsoft build tools""" | |
@@ -381,6 +401,21 @@ def run(self): | |||
| 381 | 401 | ||
| 382 | 402 | return install_data.install_data.run(self) | |
| 383 | 403 | ||
| 404 | + class InstallPythonnet(install.install): | ||
| 405 | + user_options = install.install.user_options + [ | ||
| 406 | + ('xplat', None, None) | ||
| 407 | + ] | ||
| 408 | + def initialize_options(self): | ||
| 409 | + install.install.initialize_options(self) | ||
| 410 | + self.xplat = None | ||
| 411 | + | ||
| 412 | + def finalize_options(self): | ||
| 413 | + install.install.finalize_options(self) | ||
| 414 | + | ||
| 415 | + def run(self): | ||
| 416 | + if self.xplat: | ||
| 417 | + _update_xlat_devtools() | ||
| 418 | + return install.install.run(self) | ||
| 384 | 419 | ||
| 385 | 420 | ############################################################################### | |
| 386 | 421 | setupdir = os.path.dirname(__file__) | |
@@ -410,6 +445,7 @@ def run(self): | |||
| 410 | 445 | ]), | |
| 411 | 446 | ], | |
| 412 | 447 | cmdclass={ | |
| 448 | + "install": InstallPythonnet, | ||
| 413 | 449 | "build_ext": BuildExtPythonnet, | |
| 414 | 450 | "install_lib": InstallLibPythonnet, | |
| 415 | 451 | "install_data": InstallDataPythonnet, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments