Convert projects to SDK style by filmor · Pull Request #1209 · pythonnet/pythonnet · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 15 additions & 36 deletions .github/workflows/main.yml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/src/runtime/interopNative.cs

# Configuration data
configured.props

# General binaries and Build results
*.dll
*.exe
Expand All @@ -17,6 +20,7 @@ __pycache__/
build/
dist/
*.egg-info/
.eggs/

# Unit test / coverage reports
htmlcov/
Expand Down
17 changes: 17 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<VersionPrefix>3.0.0</VersionPrefix>
<AssemblyCopyright>Copyright (c) 2006-2020 The Contributors of the Python.NET Project</AssemblyCopyright>
<AssemblyCompany>pythonnet</AssemblyCompany>
<AssemblyProduct>Python.NET</AssemblyProduct>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NonCopyableAnalyzer" Version="0.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)configured.props" Condition="Exists('$(MSBuildThisFileDirectory)configured.props')" />
</Project>
7 changes: 0 additions & 7 deletions NuGet.config

This file was deleted.

37 changes: 6 additions & 31 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ platform:

environment:
global:
PYTHONUNBUFFERED: True
PYTHONUNBUFFERED: 'True'
PYTHONWARNINGS: 'ignore:::wheel.pep425tags:'
CODECOV_ENV: PYTHON_VERSION, PLATFORM

matrix:
- PYTHON_VERSION: 3.9
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.8
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.7
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.6
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.9
- PYTHON_VERSION: 3.8
- PYTHON_VERSION: 3.7
Expand All @@ -47,35 +39,18 @@ init:
install:
- python -m pip install -U pip
- pip install --upgrade -r requirements.txt --quiet
- pip install pycparser --quiet

# Install OpenCover. Can't put on `packages.config`, not Mono compatible
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet

build_script:
- python setup.py configure
# Create clean `sdist`. Only used for releases
- python setup.py --quiet sdist
# Build `wheel` with coverage of `setup.py`
- coverage run setup.py bdist_wheel %BUILD_OPTS%
- python setup.py bdist_wheel

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

on_finish:
# Temporary disable multiple upload due to codecov limit of 20 per commit.
# https://docs.codecov.io/blog/week-8-2017
- coverage xml -i
# - codecov --file coverage.xml --flags setup_windows
# - codecov --file py.coverage --flags python_tests
# - codecov --file cs.coverage --flags embedded_tests
- codecov --file py.coverage cs.coverage coverage.xml --flags setup_windows
#- ps: .\ci\appveyor_run_tests.ps1
- pytest
- dotnet test src/embed_tests/

artifacts:
- path: dist\*
- path: '.\src\runtime\bin\*.nupkg'

notifications:
- provider: Slack
incoming_webhook:
secure: 2S/t6rGHdbwoxehnvn5KgfsHrBFEtwnPD7M5olGErmz70oWFVpqoWd/EvDwh7rKZGdOTjDmpwcukc2xi5VRaGHbBAqFYS3tAdgAMrcaTNWs=
41 changes: 41 additions & 0 deletions clr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
Legacy Python.NET loader for backwards compatibility
"""

def _get_netfx_path():
import os, sys

if sys.maxsize > 2 ** 32:
arch = "amd64"
else:
arch = "x86"

return os.path.join(os.path.dirname(__file__), "pythonnet", "netfx", arch, "clr.pyd")


def _get_mono_path():
import os, glob

paths = glob.glob(os.path.join(os.path.dirname(__file__), "pythonnet", "mono", "clr.*so"))
return paths[0]


def _load_clr():
import sys
from importlib import util

if sys.platform == "win32":
path = _get_netfx_path()
else:
path = _get_mono_path()

del sys.modules[__name__]

spec = util.spec_from_file_location("clr", path)
clr = util.module_from_spec(spec)
spec.loader.exec_module(clr)

sys.modules[__name__] = clr


_load_clr()
3 changes: 3 additions & 0 deletions pyproject.toml
Loading