@@ -120,7 +120,9 @@ def run(self):
120
120
_write_configure_props ()
121
121
122
122
for lib in dotnet_modules :
123
- output = lib .args .pop ("output" )
123
+ output = os .path .join (self .build_lib , lib .args .pop ("output" ))
124
+ rename = lib .args .pop ("rename" , {})
125
+
124
126
opts = sum (
125
127
[
126
128
["--" + name .replace ("_" , "-" ), value ]
@@ -130,15 +132,30 @@ def run(self):
130
132
)
131
133
132
134
opts .extend (["--configuration" , self .dotnet_config ])
133
- opts .extend (["--output" , os . path . join ( self . build_lib , output ) ])
135
+ opts .extend (["--output" , output ])
134
136
137
+ self .announce ("Running dotnet build..." , level = distutils .log .INFO )
135
138
self .spawn (["dotnet" , "build" , lib .path ] + opts )
136
139
137
- self .distribution .ext_modules = other_modules
140
+ for k , v in rename .items ():
141
+ source = os .path .join (output , k )
142
+ dest = os .path .join (output , v )
143
+
144
+ if os .path .isfile (source ):
145
+ try :
146
+ os .remove (dest )
147
+ except OSError :
148
+ pass
138
149
139
- super ().run ()
150
+ self .move_file (src = source , dst = dest , level = distutils .log .INFO )
151
+ else :
152
+ self .warn ("Can't find file to rename: %s" % source )
140
153
141
- self .distribution .ext_modules = orig_modules
154
+ if other_modules :
155
+ self .distribution .ext_modules = other_modules
156
+ super ().run ()
157
+ self .distribution .ext_modules = orig_modules
158
+ # If no modules need to be compiled, skip
142
159
143
160
144
161
class bdist_wheel_patched (bdist_wheel ):
@@ -159,12 +176,14 @@ def finalize_options(self):
159
176
"src/clrmodule/" ,
160
177
runtime = "win-x64" ,
161
178
output = "pythonnet/dlls/amd64" ,
179
+ rename = {"clr.dll" : "clr.pyd" },
162
180
),
163
181
DotnetLib (
164
182
"clrmodule-x86" ,
165
183
"src/clrmodule/" ,
166
184
runtime = "win-x86" ,
167
185
output = "pythonnet/dlls/x86" ,
186
+ rename = {"clr.dll" : "clr.pyd" },
168
187
),
169
188
]
170
189
@@ -186,9 +205,6 @@ def finalize_options(self):
186
205
)
187
206
ext_modules .append (clr_ext )
188
207
except Exception :
189
- import traceback
190
-
191
- traceback .print_exc ()
192
208
print ("Failed to find mono libraries via pkg-config, skipping the Mono CLR loader" )
193
209
194
210
@@ -208,6 +224,7 @@ def finalize_options(self):
208
224
"bdist_wheel" : bdist_wheel_patched ,
209
225
"configure" : Configure ,
210
226
},
227
+ py_modules = ["clr" ],
211
228
ext_modules = ext_modules ,
212
229
classifiers = [
213
230
"Development Status :: 5 - Production/Stable" ,
0 commit comments