|
3 | 3 | import distutils |
4 | 4 | from distutils.command.build import build as _build |
5 | 5 | from setuptools.command.develop import develop as _develop |
6 | | -from wheel.bdist_wheel import bdist_wheel as _bdist_wheel |
7 | 6 | from setuptools import Distribution |
8 | 7 | from setuptools import setup, Command |
9 | 8 |
|
10 | 9 | import os |
| 10 | +import sys |
11 | 11 |
|
12 | 12 | # Disable SourceLink during the build until it can read repo-format v1, #1613 |
13 | 13 | os.environ["EnableSourceControlManagerQueries"] = "false" |
14 | 14 |
|
| 15 | +NET46_SUPPORT_OPTION = "--net46-support" |
| 16 | +NET46_SUPPORT = NET46_SUPPORT_OPTION in sys.argv |
| 17 | +if NET46_SUPPORT: |
| 18 | + sys.argv.remove(NET46_SUPPORT_OPTION) |
| 19 | + |
15 | 20 |
|
16 | 21 | class DotnetLib: |
17 | 22 | def __init__(self, name, path, **kwargs): |
@@ -106,33 +111,27 @@ def install_for_development(self): |
106 | 111 | return super().install_for_development() |
107 | 112 |
|
108 | 113 |
|
109 | | -class bdist_wheel(_bdist_wheel): |
110 | | - def finalize_options(self): |
111 | | - # Monkey patch bdist_wheel to think the package is pure even though we |
112 | | - # include DLLs |
113 | | - super().finalize_options() |
114 | | - self.root_is_pure = True |
115 | | - |
116 | | - |
117 | 114 | # Monkey-patch Distribution s.t. it supports the dotnet_libs attribute |
118 | 115 | Distribution.dotnet_libs = None |
119 | 116 |
|
120 | 117 | cmdclass = { |
121 | 118 | "build": build, |
122 | 119 | "build_dotnet": build_dotnet, |
123 | 120 | "develop": develop, |
124 | | - "bdist_wheel": bdist_wheel, |
125 | 121 | } |
126 | 122 |
|
127 | | -dotnet_libs = [ |
128 | | - DotnetLib( |
129 | | - "python-runtime", |
130 | | - "src/runtime/Python.Runtime.csproj", |
131 | | - output="pythonnet/runtime", |
132 | | - ) |
133 | | -] |
| 123 | + |
| 124 | +if NET46_SUPPORT: |
| 125 | + csproj = "src/compat/Python.Runtime.Compat.csproj" |
| 126 | + plat_name = "win32" |
| 127 | +else: |
| 128 | + csproj = "src/runtime/Python.Runtime.csproj" |
| 129 | + plat_name = "any" |
| 130 | + |
| 131 | +dotnet_libs = [DotnetLib("python-runtime", csproj, output="pythonnet/runtime")] |
134 | 132 |
|
135 | 133 | setup( |
136 | 134 | cmdclass=cmdclass, |
137 | 135 | dotnet_libs=dotnet_libs, |
| 136 | + options={"bdist_wheel": {"plat_name": plat_name}}, |
138 | 137 | ) |
0 commit comments