1
1
#!/usr/bin/env python
2
2
3
- from setuptools import setup , find_packages
4
- from distutils . cmd import Command
3
+ from setuptools import setup , find_packages , Command , Extension
4
+ from wheel . bdist_wheel import bdist_wheel
5
5
6
6
7
- class DotnetLib :
8
- def __init__ (self , path , ** kwargs ):
7
+ class DotnetLib ( Extension ) :
8
+ def __init__ (self , name , path , ** kwargs ):
9
9
self .path = path
10
10
self .args = kwargs
11
+ super ().__init__ (name , sources = [])
11
12
12
13
13
14
class BuildDotnet (Command ):
@@ -22,8 +23,10 @@ def initialize_options(self):
22
23
def finalize_options (self ):
23
24
pass
24
25
26
+ def get_source_files (self ):
27
+ return []
28
+
25
29
def run (self ):
26
- # self.spawn(["./build_netfx_loader.sh"])
27
30
for lib in self .distribution .ext_modules :
28
31
opts = sum (
29
32
[
@@ -39,6 +42,14 @@ def run(self):
39
42
self .spawn (["dotnet" , "build" , lib .path ] + opts )
40
43
41
44
45
+ class bdist_wheel_patched (bdist_wheel ):
46
+ def finalize_options (self ):
47
+ # Monkey patch bdist_wheel to think the package is pure even though we
48
+ # include DLLs
49
+ super ().finalize_options ()
50
+ self .root_is_pure = True
51
+
52
+
42
53
with open ("README.md" , "r" ) as f :
43
54
long_description = f .read ()
44
55
@@ -51,6 +62,7 @@ def run(self):
51
62
long_description = long_description ,
52
63
long_description_content_type = "text/markdown" ,
53
64
license = "MIT" ,
65
+ python_requires = ">=3.3" ,
54
66
install_requires = ["cffi" ],
55
67
classifiers = [
56
68
"Development Status :: 2 - Pre-Alpha" ,
@@ -63,11 +75,19 @@ def run(self):
63
75
],
64
76
package_data = {"clr_loader.ffi" : ["dlls/x86/*.dll" , "dlls/amd64/*.dll" ]},
65
77
packages = find_packages (),
66
- cmdclass = {"build_ext" : BuildDotnet },
78
+ cmdclass = {"build_ext" : BuildDotnet , "bdist_wheel" : bdist_wheel_patched },
67
79
ext_modules = {
68
- DotnetLib ("netfx_loader/" , runtime = "win-x86" , output = "clr_loader/ffi/dlls/x86" ),
69
80
DotnetLib (
70
- "netfx_loader/" , runtime = "win-x64" , output = "clr_loader/ffi/dlls/amd64"
81
+ "netfx-loader-x86" ,
82
+ "netfx_loader/" ,
83
+ runtime = "win-x86" ,
84
+ output = "clr_loader/ffi/dlls/x86" ,
85
+ ),
86
+ DotnetLib (
87
+ "netfx-loader-amd64" ,
88
+ "netfx_loader/" ,
89
+ runtime = "win-x64" ,
90
+ output = "clr_loader/ffi/dlls/amd64" ,
71
91
),
72
92
},
73
93
)
0 commit comments