Skip to content

Commit 1156ef3

Browse files
committed
Convert projects to SDK style
- Convert tests to SDK style - Delete obsolete files and add common build props - Convert Runtime to SDK style and always use .NET Standard - Convert console to SDK style - Convert clrmodule to SDK style and switch to NXPorts
1 parent d0c588b commit 1156ef3

36 files changed

+331
-2317
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Configuration data
2+
configured.props
3+
14
# General binaries and Build results
25
*.dll
36
*.exe
@@ -15,6 +18,7 @@ __pycache__/
1518
build/
1619
dist/
1720
*.egg-info/
21+
.eggs/
1822

1923
# Unit test / coverage reports
2024
htmlcov/

.travis.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ python:
77
- 3.6
88

99
env:
10-
matrix:
11-
- BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp2.0_publish/ PERF_TESTS_PATH=net461/
12-
- BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH=""
13-
- PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp2.0_publish/ PERF_TESTS_PATH=net461/
14-
- PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH=""
15-
1610
global:
1711
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
1812
- SEGFAULT_SIGNALS=all
@@ -29,9 +23,9 @@ addons:
2923
packages:
3024
- mono-devel
3125
- ca-certificates-mono
32-
- dotnet-hostfxr-2.2
33-
- dotnet-runtime-2.2
34-
- dotnet-sdk-2.2
26+
- dotnet-hostfxr-3.1
27+
- dotnet-runtime-3.1
28+
- dotnet-sdk-3.1
3529

3630
before_install:
3731
# Set-up dll path for embedded tests
@@ -41,20 +35,11 @@ before_install:
4135
install:
4236
- pip install --upgrade setuptools # TEMP - due to setuptools 36.2.0 bug
4337
- pip install --upgrade -r requirements.txt
44-
- coverage run setup.py install $BUILD_OPTS
38+
- python setup.py install $BUILD_OPTS
4539

4640
script:
4741
- python -m pytest
48-
- $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll --labels=All
42+
# TODO: Run tests also with Mono
43+
- dotnet test src/embed_tests
4944
# does not work on Linux, because NuGet package for 2.3 is Windows only
5045
# - "if [[ $TRAVIS_PYTHON_VERSION == '3.5' && $PERF_TESTS_PATH != '' ]]; then mono $NUNIT_PATH src/perf_tests/bin/$PERF_TESTS_PATH/Python.PerformanceTests.dll; fi"
51-
52-
after_script:
53-
# Waiting on mono-coverage, SharpCover or xr.Baboon
54-
- coverage xml -i
55-
- codecov --file coverage.xml --flags setup_linux
56-
57-
notifications:
58-
email: false
59-
slack:
60-
secure: "UiQdSK1/uNnHl8/gQgfLj/F5JGxtJuaT3QYtKNcw3Ddpr3FX8tfXJ/RjsCsSlRQzDm7AdBAeMzcBQmvH4iRIV2y7qVywLyru5MPiwY4ZjMN6fJK/zaaxetOct9fasIBYzHguNPDAtiBGFh2iK1H1MXTY8rkmU3WZvl18b8EsrP0="

Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<PropertyGroup>
3+
<VersionPrefix>3.0.0</VersionPrefix>
4+
<AssemblyCopyright>Copyright (c) 2006-2020 The Contributors of the Python.NET Project</AssemblyCopyright>
5+
<AssemblyCompany>pythonnet</AssemblyCompany>
6+
<AssemblyProduct>Python.NET</AssemblyProduct>
7+
<LangVersion>7.3</LangVersion>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
11+
<PackageReference Include="NonCopyableAnalyzer" Version="0.6.0">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
15+
</ItemGroup>
16+
<Import Project="$(MSBuildThisFileDirectory)configured.props" Condition="Exists('$(MSBuildThisFileDirectory)configured.props')" />
17+
</Project>

NuGet.config

Lines changed: 0 additions & 7 deletions
This file was deleted.

appveyor.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@ platform:
1010

1111
environment:
1212
global:
13-
PYTHONUNBUFFERED: True
13+
PYTHONUNBUFFERED: 'True'
1414
PYTHONWARNINGS: 'ignore:::wheel.pep425tags:'
1515
CODECOV_ENV: PYTHON_VERSION, PLATFORM
1616

1717
matrix:
18-
- PYTHON_VERSION: 3.8
19-
BUILD_OPTS: --xplat
20-
- PYTHON_VERSION: 3.7
21-
BUILD_OPTS: --xplat
22-
- PYTHON_VERSION: 3.6
23-
BUILD_OPTS: --xplat
2418
- PYTHON_VERSION: 3.8
2519
- PYTHON_VERSION: 3.7
2620
- PYTHON_VERSION: 3.6
@@ -42,35 +36,16 @@ init:
4236
install:
4337
- python -m pip install -U pip
4438
- pip install --upgrade -r requirements.txt --quiet
45-
- pip install pycparser --quiet
46-
47-
# Install OpenCover. Can't put on `packages.config`, not Mono compatible
48-
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet
4939

5040
build_script:
41+
- python setup.py configure
5142
# Create clean `sdist`. Only used for releases
5243
- python setup.py --quiet sdist
53-
# Build `wheel` with coverage of `setup.py`
54-
- coverage run setup.py bdist_wheel %BUILD_OPTS%
44+
- python setup.py bdist_wheel
5545

5646
test_script:
5747
- pip install --no-index --find-links=.\dist\ pythonnet
5848
- ps: .\ci\appveyor_run_tests.ps1
5949

60-
on_finish:
61-
# Temporary disable multiple upload due to codecov limit of 20 per commit.
62-
# https://docs.codecov.io/blog/week-8-2017
63-
- coverage xml -i
64-
# - codecov --file coverage.xml --flags setup_windows
65-
# - codecov --file py.coverage --flags python_tests
66-
# - codecov --file cs.coverage --flags embedded_tests
67-
- codecov --file py.coverage cs.coverage coverage.xml --flags setup_windows
68-
6950
artifacts:
7051
- path: dist\*
71-
- path: '.\src\runtime\bin\*.nupkg'
72-
73-
notifications:
74-
- provider: Slack
75-
incoming_webhook:
76-
secure: 2S/t6rGHdbwoxehnvn5KgfsHrBFEtwnPD7M5olGErmz70oWFVpqoWd/EvDwh7rKZGdOTjDmpwcukc2xi5VRaGHbBAqFYS3tAdgAMrcaTNWs=

clr.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Legacy Python.NET loader for backwards compatibility
3+
"""
4+
5+
def _load():
6+
import os, sys
7+
import importlib.util as util
8+
9+
if sys.maxsize > 2 ** 32:
10+
arch = "amd64"
11+
else:
12+
arch = "x86"
13+
14+
path = os.path.join(os.path.dirname(__file__), "pythonnet", "dlls", arch, "clr.pyd")
15+
del sys.modules["clr"]
16+
17+
spec = util.spec_from_file_location("clr", path)
18+
clr = util.module_from_spec(spec)
19+
spec.loader.exec_module(clr)
20+
21+
sys.modules["clr"] = clr
22+
23+
_load()

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]

0 commit comments

Comments
 (0)