Support .NET Framework 4.6.1 by Metadorius · Pull Request #2701 · pythonnet/pythonnet
import os import sys
# Disable SourceLink during the build until it can read repo-format v1, #1613 os.environ["EnableSourceControlManagerQueries"] = "false"
NET46_SUPPORT_OPTION = "--net46-support" NET46_SUPPORT = NET46_SUPPORT_OPTION in sys.argv if NET46_SUPPORT: sys.argv.remove(NET46_SUPPORT_OPTION)
class DotnetLib: def __init__(self, name, path, **kwargs):
class bdist_wheel(_bdist_wheel): def finalize_options(self): # Monkey patch bdist_wheel to think the package is pure even though we # include DLLs super().finalize_options() self.root_is_pure = True
# Monkey-patch Distribution s.t. it supports the dotnet_libs attribute Distribution.dotnet_libs = None
cmdclass = { "build": build, "build_dotnet": build_dotnet, "develop": develop, "bdist_wheel": bdist_wheel, }
dotnet_libs = [ DotnetLib( "python-runtime", "src/runtime/Python.Runtime.csproj", output="pythonnet/runtime", ) ]
if NET46_SUPPORT: csproj = "src/compat/Python.Runtime.Compat.csproj" plat_name = "win32" else: csproj = "src/runtime/Python.Runtime.csproj" plat_name = "any"
dotnet_libs = [DotnetLib("python-runtime", csproj, output="pythonnet/runtime")]
setup( cmdclass=cmdclass, dotnet_libs=dotnet_libs, options={"bdist_wheel": {"plat_name": plat_name}}, )