| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,80 +1,17 @@ | |||
| 1 | - dist: trusty | ||
| 1 | + dist: xenial | ||
| 2 | 2 | sudo: false | |
| 3 | 3 | language: python | |
| 4 | - | ||
| 5 | - matrix: | ||
| 6 | - include: | ||
| 7 | - # --------------------- XPLAT builds ------------------------ | ||
| 8 | - - python: 2.7 | ||
| 9 | - env: &xplat-env | ||
| 10 | - - BUILD_OPTS=--xplat | ||
| 11 | - - NUNIT_PATH=~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe | ||
| 12 | - addons: &xplat-addons | ||
| 13 | - apt: | ||
| 14 | - sources: | ||
| 15 | - - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main | ||
| 16 | - key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 17 | - - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 18 | - key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 19 | - packages: | ||
| 20 | - - mono-devel | ||
| 21 | - - ca-certificates-mono | ||
| 22 | - - dotnet-hostfxr-2.0.0 | ||
| 23 | - - dotnet-runtime-2.0.0 | ||
| 24 | - - dotnet-sdk-2.0.0 | ||
| 25 | - | ||
| 26 | - - python: 3.5 | ||
| 27 | - env: *xplat-env | ||
| 28 | - addons: *xplat-addons | ||
| 29 | - | ||
| 30 | - - python: 3.6 | ||
| 31 | - env: *xplat-env | ||
| 32 | - addons: *xplat-addons | ||
| 33 | - | ||
| 34 | - - python: 3.7 | ||
| 35 | - env: *xplat-env | ||
| 36 | - dist: xenial | ||
| 37 | - sudo: true | ||
| 38 | - addons: &xplat-addons-xenial | ||
| 39 | - apt: | ||
| 40 | - sources: | ||
| 41 | - - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main | ||
| 42 | - key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 43 | - - sourceline: deb https://download.mono-project.com/repo/ubuntu stable-xenial main | ||
| 44 | - key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 45 | - packages: | ||
| 46 | - - mono-devel | ||
| 47 | - - ca-certificates-mono | ||
| 48 | - - dotnet-hostfxr-2.0.0 | ||
| 49 | - - dotnet-runtime-2.0.0 | ||
| 50 | - - dotnet-sdk-2.0.0 | ||
| 51 | - | ||
| 52 | - # --------------------- Classic builds ------------------------ | ||
| 53 | - - python: 2.7 | ||
| 54 | - env: &classic-env | ||
| 55 | - - BUILD_OPTS= | ||
| 56 | - - NUNIT_PATH=./packages/NUnit.*/tools/nunit3-console.exe | ||
| 57 | - | ||
| 58 | - - python: 3.5 | ||
| 59 | - env: *classic-env | ||
| 60 | - | ||
| 61 | - - python: 3.6 | ||
| 62 | - env: *classic-env | ||
| 63 | - | ||
| 64 | - - python: 3.7 | ||
| 65 | - env: *classic-env | ||
| 66 | - dist: xenial | ||
| 67 | - sudo: true | ||
| 68 | - addons: | ||
| 69 | - apt: | ||
| 70 | - sources: | ||
| 71 | - - sourceline: deb http://download.mono-project.com/repo/ubuntu xenial main | ||
| 72 | - key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | ||
| 73 | - packages: | ||
| 74 | - - mono-devel | ||
| 75 | - - ca-certificates-mono | ||
| 4 | + python: | ||
| 5 | + - 2.7 | ||
| 6 | + - 3.5 | ||
| 7 | + - 3.6 | ||
| 8 | + - 3.7 | ||
| 76 | 9 | ||
| 77 | 10 | env: | |
| 11 | + matrix: | ||
| 12 | + - BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp2.0_publish/ | ||
| 13 | + - BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" | ||
| 14 | + | ||
| 78 | 15 | global: | |
| 79 | 16 | - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so | |
| 80 | 17 | - SEGFAULT_SIGNALS=all | |
@@ -84,11 +21,16 @@ env: | |||
| 84 | 21 | addons: | |
| 85 | 22 | apt: | |
| 86 | 23 | sources: | |
| 87 | - - sourceline: deb http://download.mono-project.com/repo/ubuntu trusty main | ||
| 24 | + - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main | ||
| 25 | + key_url: https://packages.microsoft.com/keys/microsoft.asc | ||
| 26 | + - sourceline: deb http://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/5.20 main | ||
| 88 | 27 | key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF | |
| 89 | 28 | packages: | |
| 90 | 29 | - mono-devel | |
| 91 | 30 | - ca-certificates-mono | |
| 31 | + - dotnet-hostfxr-2.2 | ||
| 32 | + - dotnet-runtime-2.2 | ||
| 33 | + - dotnet-sdk-2.2 | ||
| 92 | 34 | ||
| 93 | 35 | before_install: | |
| 94 | 36 | # Set-up dll path for embedded tests | |
@@ -102,13 +44,9 @@ install: | |||
| 102 | 44 | ||
| 103 | 45 | script: | |
| 104 | 46 | - python -m pytest | |
| 105 | - - mono $NUNIT_PATH src/embed_tests/bin/Python.EmbeddingTest.dll | ||
| 106 | - - if [[ $BUILD_OPTS == --xplat ]]; then dotnet src/embed_tests/bin/netcoreapp2.0_publish/Python.EmbeddingTest.dll; fi | ||
| 47 | + - $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll | ||
| 107 | 48 | ||
| 108 | 49 | after_script: | |
| 109 | - # Uncomment if need to geninterop, ie. py37 final | ||
| 110 | - # - python tools/geninterop/geninterop.py | ||
| 111 | - | ||
| 112 | 50 | # Waiting on mono-coverage, SharpCover or xr.Baboon | |
| 113 | 51 | - coverage xml -i | |
| 114 | 52 | - codecov --file coverage.xml --flags setup_linux | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,18 +19,23 @@ | |||
| 19 | 19 | - Callum Noble ([@callumnoble](https://github.com/callumnoble)) | |
| 20 | 20 | - Christian Heimes ([@tiran](https://github.com/tiran)) | |
| 21 | 21 | - Christoph Gohlke ([@cgohlke](https://github.com/cgohlke)) | |
| 22 | + - Christopher Bremner ([@chrisjbremner](https://github.com/chrisjbremner)) | ||
| 22 | 23 | - Christopher Pow ([@christopherpow](https://github.com/christopherpow)) | |
| 23 | 24 | - Daniel Fernandez ([@fdanny](https://github.com/fdanny)) | |
| 24 | 25 | - Daniel Santana ([@dgsantana](https://github.com/dgsantana)) | |
| 25 | 26 | - Dave Hirschfeld ([@dhirschfeld](https://github.com/dhirschfeld)) | |
| 26 | 27 | - David Lassonde ([@lassond](https://github.com/lassond)) | |
| 27 | 28 | - David Lechner ([@dlech](https://github.com/dlech)) | |
| 28 | 29 | - Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse)) | |
| 30 | + - Florian Treurniet ([@ftreurni](https://github.com/ftreurni)) | ||
| 29 | 31 | - He-chien Tsai ([@t3476](https://github.com/t3476)) | |
| 30 | - - Ivan Cronyn ([@cronan](https://github.com/cronan)) | ||
| 32 | + - Inna Wiesel ([@inna-w](https://github.com/inna-w)) | ||
| 33 | + - Ivan Cronyn ([@cronan](https://github.com/cronan)) | ||
| 31 | 34 | - Jan Krivanek ([@jakrivan](https://github.com/jakrivan)) | |
| 32 | - - Jeff Reback ([@jreback](https://github.com/jreback)) | ||
| 35 | + - Jeff Reback ([@jreback](https://github.com/jreback)) | ||
| 33 | 36 | - Joe Frayne ([@jfrayne](https://github.com/jfrayne)) | |
| 37 | + - Joe Lidbetter ([@jmlidbetter](https://github.com/jmlidbetter)) | ||
| 38 | + - Joe Savage ([@s4v4g3](https://github.com/s4v4g3)) | ||
| 34 | 39 | - John Burnett ([@johnburnett](https://github.com/johnburnett)) | |
| 35 | 40 | - John Wilkes ([@jbw3](https://github.com/jbw3)) | |
| 36 | 41 | - Luke Stratman ([@lstratman](https://github.com/lstratman)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,10 +9,23 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. | |||
| 9 | 9 | ||
| 10 | 10 | ### Added | |
| 11 | 11 | ||
| 12 | + - Added automatic NuGet package generation in appveyor and local builds | ||
| 13 | + | ||
| 12 | 14 | ### Changed | |
| 13 | 15 | ||
| 16 | + - Added argument types information to "No method matches given arguments" message | ||
| 17 | + - Moved wheel import in setup.py inside of a try/except to prevent pip collection failures | ||
| 18 | + - Removes PyLong_GetMax and PyClass_New when targetting Python3 | ||
| 19 | + - Added support for converting python iterators to C# arrays | ||
| 20 | + - Changed usage of obselete function GetDelegateForFunctionPointer(IntPtr, Type) to GetDelegateForFunctionPointer<TDelegate>(IntPtr) | ||
| 21 | + - Added support for kwarg parameters when calling .NET methods from Python | ||
| 22 | + | ||
| 14 | 23 | ### Fixed | |
| 15 | 24 | ||
| 25 | + - Fixed runtime that fails loading when using pythonnet in an environment | ||
| 26 | + together with Nuitka | ||
| 27 | + - Fixes bug where delegates get casts (dotnetcore) | ||
| 28 | + | ||
| 16 | 29 | ## [2.4.0][] | |
| 17 | 30 | ||
| 18 | 31 | ### Added | |
@@ -55,7 +68,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. | |||
| 55 | 68 | - Fixed conversion of 'float' and 'double' values ([#486][i486]) | |
| 56 | 69 | - Fixed 'clrmethod' for python 2 ([#492][i492]) | |
| 57 | 70 | - Fixed double calling of constructor when deriving from .NET class ([#495][i495]) | |
| 58 | - - Fixed `clr.GetClrType` when iterating over `System` members ([#607][p607]) | ||
| 71 | + - Fixed `clr.GetClrType` when iterating over `System` members ([#607][p607]) | ||
| 59 | 72 | - Fixed `LockRecursionException` when loading assemblies ([#627][i627]) | |
| 60 | 73 | - Fixed errors breaking .NET Remoting on method invoke ([#276][i276]) | |
| 61 | 74 | - Fixed PyObject.GetHashCode ([#676][i676]) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ pythonnet - Python for .NET | |||
| 5 | 5 | ||
| 6 | 6 | |appveyor shield| |travis shield| |codecov shield| | |
| 7 | 7 | ||
| 8 | - |license shield| |pypi package version| |python supported shield| | ||
| 8 | + |license shield| |pypi package version| |conda-forge version| |python supported shield| | ||
| 9 | 9 | |stackexchange shield| | |
| 10 | 10 | ||
| 11 | 11 | Python for .NET is a package that gives Python programmers nearly | |
@@ -111,3 +111,5 @@ https://github.com/pythonnet/pythonnet/wiki | |||
| 111 | 111 | :target: https://pypi.python.org/pypi/pythonnet | |
| 112 | 112 | .. |stackexchange shield| image:: https://img.shields.io/badge/StackOverflow-python.net-blue.svg | |
| 113 | 113 | :target: http://stackoverflow.com/questions/tagged/python.net | |
| 114 | + .. |conda-forge version| image:: https://img.shields.io/conda/vn/conda-forge/pythonnet.svg | ||
| 115 | + :target: https://anaconda.org/conda-forge/pythonnet | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,6 +72,7 @@ on_finish: | |||
| 72 | 72 | ||
| 73 | 73 | artifacts: | |
| 74 | 74 | - path: dist\* | |
| 75 | + - path: '.\src\runtime\bin\*.nupkg' | ||
| 75 | 76 | ||
| 76 | 77 | notifications: | |
| 77 | 78 | - provider: Slack | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,10 +15,14 @@ | |||
| 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 | ||
| 19 | 18 | ||
| 20 | 19 | from setuptools import Extension, setup | |
| 21 | 20 | ||
| 21 | + try: | ||
| 22 | + from wheel import bdist_wheel | ||
| 23 | + except ImportError: | ||
| 24 | + bdist_wheel = None | ||
| 25 | + | ||
| 22 | 26 | # Allow config/verbosity to be set from cli | |
| 23 | 27 | # http://stackoverflow.com/a/4792601/5208670 | |
| 24 | 28 | CONFIG = "Release" # Release or Debug | |
@@ -334,6 +338,7 @@ def build_extension(self, ext): | |||
| 334 | 338 | ), | |
| 335 | 339 | '/p:PythonBuildDir="{}"'.format(os.path.abspath(dest_dir)), | |
| 336 | 340 | '/p:PythonInteropFile="{}"'.format(os.path.basename(interop_file)), | |
| 341 | + "/p:PackageId=pythonnet_py{0}{1}_{2}".format(PY_MAJOR, PY_MINOR, ARCH), | ||
| 337 | 342 | "/verbosity:{}".format(VERBOSITY), | |
| 338 | 343 | ] | |
| 339 | 344 | ||
@@ -608,21 +613,21 @@ def run(self): | |||
| 608 | 613 | _update_xlat_devtools() | |
| 609 | 614 | return install.install.run(self) | |
| 610 | 615 | ||
| 616 | + if bdist_wheel: | ||
| 617 | + class BDistWheelPythonnet(bdist_wheel.bdist_wheel): | ||
| 618 | + user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)] | ||
| 611 | 619 | ||
| 612 | - class BDistWheelPythonnet(bdist_wheel.bdist_wheel): | ||
| 613 | - user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)] | ||
| 620 | + def initialize_options(self): | ||
| 621 | + bdist_wheel.bdist_wheel.initialize_options(self) | ||
| 622 | + self.xplat = None | ||
| 614 | 623 | ||
| 615 | - def initialize_options(self): | ||
| 616 | - bdist_wheel.bdist_wheel.initialize_options(self) | ||
| 617 | - self.xplat = None | ||
| 624 | + def finalize_options(self): | ||
| 625 | + bdist_wheel.bdist_wheel.finalize_options(self) | ||
| 618 | 626 | ||
| 619 | - def finalize_options(self): | ||
| 620 | - bdist_wheel.bdist_wheel.finalize_options(self) | ||
| 621 | - | ||
| 622 | - def run(self): | ||
| 623 | - if self.xplat: | ||
| 624 | - _update_xlat_devtools() | ||
| 625 | - return bdist_wheel.bdist_wheel.run(self) | ||
| 627 | + def run(self): | ||
| 628 | + if self.xplat: | ||
| 629 | + _update_xlat_devtools() | ||
| 630 | + return bdist_wheel.bdist_wheel.run(self) | ||
| 626 | 631 | ||
| 627 | 632 | ############################################################################### | |
| 628 | 633 | ||
@@ -635,6 +640,15 @@ def run(self): | |||
| 635 | 640 | if not os.path.exists(_get_interop_filename()): | |
| 636 | 641 | setup_requires.append("pycparser") | |
| 637 | 642 | ||
| 643 | + cmdclass={ | ||
| 644 | + "install": InstallPythonnet, | ||
| 645 | + "build_ext": BuildExtPythonnet, | ||
| 646 | + "install_lib": InstallLibPythonnet, | ||
| 647 | + "install_data": InstallDataPythonnet, | ||
| 648 | + } | ||
| 649 | + if bdist_wheel: | ||
| 650 | + cmdclass["bdist_wheel"] = BDistWheelPythonnet | ||
| 651 | + | ||
| 638 | 652 | setup( | |
| 639 | 653 | name="pythonnet", | |
| 640 | 654 | version="2.4.1-dev", | |
@@ -647,13 +661,7 @@ def run(self): | |||
| 647 | 661 | long_description=_get_long_description(), | |
| 648 | 662 | ext_modules=[Extension("clr", sources=list(_get_source_files()))], | |
| 649 | 663 | data_files=[("{install_platlib}", ["{build_lib}/Python.Runtime.dll"])], | |
| 650 | - cmdclass={ | ||
| 651 | - "install": InstallPythonnet, | ||
| 652 | - "build_ext": BuildExtPythonnet, | ||
| 653 | - "install_lib": InstallLibPythonnet, | ||
| 654 | - "install_data": InstallDataPythonnet, | ||
| 655 | - "bdist_wheel": BDistWheelPythonnet, | ||
| 656 | - }, | ||
| 664 | + cmdclass=cmdclass, | ||
| 657 | 665 | classifiers=[ | |
| 658 | 666 | "Development Status :: 5 - Production/Stable", | |
| 659 | 667 | "Intended Audience :: Developers", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + using System; | ||
| 2 | + | ||
| 3 | + using NUnit.Framework; | ||
| 4 | + using Python.Runtime; | ||
| 5 | + | ||
| 6 | + namespace Python.EmbeddingTest { | ||
| 7 | + using Runtime = Python.Runtime.Runtime; | ||
| 8 | + | ||
| 9 | + public class TestCallbacks { | ||
| 10 | + [OneTimeSetUp] | ||
| 11 | + public void SetUp() { | ||
| 12 | + PythonEngine.Initialize(); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + [OneTimeTearDown] | ||
| 16 | + public void Dispose() { | ||
| 17 | + PythonEngine.Shutdown(); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + [Test] | ||
| 21 | + public void TestNoOverloadException() { | ||
| 22 | + int passed = 0; | ||
| 23 | + var aFunctionThatCallsIntoPython = new Action<int>(value => passed = value); | ||
| 24 | + using (Py.GIL()) { | ||
| 25 | + dynamic callWith42 = PythonEngine.Eval("lambda f: f([42])"); | ||
| 26 | + var error = Assert.Throws<PythonException>(() => callWith42(aFunctionThatCallsIntoPython.ToPython())); | ||
| 27 | + Assert.AreEqual("TypeError", error.PythonTypeName); | ||
| 28 | + string expectedArgTypes = Runtime.IsPython2 | ||
| 29 | + ? "(<type 'list'>)" | ||
| 30 | + : "(<class 'list'>)"; | ||
| 31 | + StringAssert.EndsWith(expectedArgTypes, error.Message); | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,7 @@ public void CollectBasicObject() | |||
| 45 | 45 | called = true; | |
| 46 | 46 | }; | |
| 47 | 47 | ||
| 48 | - Assert.IsFalse(called); | ||
| 48 | + Assert.IsFalse(called, "The event handler was called before it was installed"); | ||
| 49 | 49 | Finalizer.Instance.CollectOnce += handler; | |
| 50 | 50 | ||
| 51 | 51 | WeakReference shortWeak; | |
@@ -55,13 +55,25 @@ public void CollectBasicObject() | |||
| 55 | 55 | } | |
| 56 | 56 | FullGCCollect(); | |
| 57 | 57 | // The object has been resurrected | |
| 58 | - Assert.IsFalse(shortWeak.IsAlive); | ||
| 59 | - Assert.IsTrue(longWeak.IsAlive); | ||
| 58 | + Warn.If( | ||
| 59 | + shortWeak.IsAlive, | ||
| 60 | + "The referenced object is alive although it should have been collected", | ||
| 61 | + shortWeak | ||
| 62 | + ); | ||
| 63 | + Assert.IsTrue( | ||
| 64 | + longWeak.IsAlive, | ||
| 65 | + "The reference object is not alive although it should still be", | ||
| 66 | + longWeak | ||
| 67 | + ); | ||
| 60 | 68 | ||
| 61 | 69 | { | |
| 62 | 70 | var garbage = Finalizer.Instance.GetCollectedObjects(); | |
| 63 | - Assert.NotZero(garbage.Count); | ||
| 64 | - Assert.IsTrue(garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target))); | ||
| 71 | + Assert.NotZero(garbage.Count, "There should still be garbage around"); | ||
| 72 | + Warn.Unless( | ||
| 73 | + garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target)), | ||
| 74 | + $"The {nameof(longWeak)} reference doesn't show up in the garbage list", | ||
| 75 | + garbage | ||
| 76 | + ); | ||
| 65 | 77 | } | |
| 66 | 78 | try | |
| 67 | 79 | { | |
@@ -71,7 +83,7 @@ public void CollectBasicObject() | |||
| 71 | 83 | { | |
| 72 | 84 | Finalizer.Instance.CollectOnce -= handler; | |
| 73 | 85 | } | |
| 74 | - Assert.IsTrue(called); | ||
| 86 | + Assert.IsTrue(called, "The event handler was not called during finalization"); | ||
| 75 | 87 | Assert.GreaterOrEqual(objectCount, 1); | |
| 76 | 88 | } | |
| 77 | 89 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments