Skip to content

Commit f811e51

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 f8c27a1 commit f811e51

35 files changed

+315
-2283
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/src/runtime/interopNative.cs
22

3+
# Configuration data
4+
configured.props
5+
36
# General binaries and Build results
47
*.dll
58
*.exe
@@ -17,6 +20,7 @@ __pycache__/
1720
build/
1821
dist/
1922
*.egg-info/
23+
.eggs/
2024

2125
# Unit test / coverage reports
2226
htmlcov/

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 & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ platform:
1010

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

@@ -47,35 +47,16 @@ init:
4747
install:
4848
- python -m pip install -U pip
4949
- pip install --upgrade -r requirements.txt --quiet
50-
- pip install pycparser --quiet
51-
52-
# Install OpenCover. Can't put on `packages.config`, not Mono compatible
53-
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet
5450

5551
build_script:
52+
- python setup.py configure
5653
# Create clean `sdist`. Only used for releases
5754
- python setup.py --quiet sdist
58-
# Build `wheel` with coverage of `setup.py`
59-
- coverage run setup.py bdist_wheel %BUILD_OPTS%
55+
- python setup.py bdist_wheel
6056

6157
test_script:
6258
- pip install --no-index --find-links=.\dist\ pythonnet
6359
- ps: .\ci\appveyor_run_tests.ps1
6460

65-
on_finish:
66-
# Temporary disable multiple upload due to codecov limit of 20 per commit.
67-
# https://docs.codecov.io/blog/week-8-2017
68-
- coverage xml -i
69-
# - codecov --file coverage.xml --flags setup_windows
70-
# - codecov --file py.coverage --flags python_tests
71-
# - codecov --file cs.coverage --flags embedded_tests
72-
- codecov --file py.coverage cs.coverage coverage.xml --flags setup_windows
73-
7461
artifacts:
7562
- path: dist\*
76-
- path: '.\src\runtime\bin\*.nupkg'
77-
78-
notifications:
79-
- provider: Slack
80-
incoming_webhook:
81-
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"]

pythonnet.15.sln

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

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Requirements for both Travis and AppVeyor
22
pytest
3-
coverage
43
psutil
54

65
# Coverage upload
6+
coverage
77
codecov
88

99
# Platform specific requirements
1010
wheel
1111
pycparser
12+
setuptools
13+
setuptools_scm

0 commit comments

Comments
 (0)