@@ -100,6 +100,24 @@ def _get_interop_filename():
100
100
return os .path .join ("src" , "runtime" , interop_filename )
101
101
102
102
103
+ def _get_source_files ():
104
+ """Walk project and collect the files needed for ext_module"""
105
+ for ext in (".sln" , ".snk" , ".config" ):
106
+ for path in glob .glob ("*" + ext ):
107
+ yield path
108
+
109
+ for root , dirnames , filenames in os .walk ("src" ):
110
+ for ext in (".cs" , ".csproj" , ".sln" , ".snk" , ".config" , ".il" ,
111
+ ".py" , ".c" , ".h" , ".ico" ):
112
+ for filename in fnmatch .filter (filenames , "*" + ext ):
113
+ yield os .path .join (root , filename )
114
+
115
+ for root , dirnames , filenames in os .walk ("tools" ):
116
+ for ext in (".exe" , ".py" , ".c" , ".h" ):
117
+ for filename in fnmatch .filter (filenames , "*" + ext ):
118
+ yield os .path .join (root , filename )
119
+
120
+
103
121
class BuildExtPythonnet (build_ext .build_ext ):
104
122
def build_extension (self , ext ):
105
123
"""Builds the .pyd file using msbuild or xbuild"""
@@ -333,21 +351,6 @@ def run(self):
333
351
if setupdir :
334
352
os .chdir (setupdir )
335
353
336
- sources = []
337
- for ext in (".sln" , ".snk" , ".config" ):
338
- sources .extend (glob .glob ("*" + ext ))
339
-
340
- for root , dirnames , filenames in os .walk ("src" ):
341
- for ext in (".cs" , ".csproj" , ".sln" , ".snk" , ".config" , ".il" ,
342
- ".py" , ".c" , ".h" , ".ico" ):
343
- for filename in fnmatch .filter (filenames , "*" + ext ):
344
- sources .append (os .path .join (root , filename ))
345
-
346
- for root , dirnames , filenames in os .walk ("tools" ):
347
- for ext in (".exe" , ".py" , ".c" , ".h" ):
348
- for filename in fnmatch .filter (filenames , "*" + ext ):
349
- sources .append (os .path .join (root , filename ))
350
-
351
354
setup_requires = []
352
355
interop_file = _get_interop_filename ()
353
356
if not os .path .exists (interop_file ):
@@ -377,7 +380,7 @@ def run(self):
377
380
'Operating System :: MacOS :: MacOS X' ,
378
381
],
379
382
ext_modules = [
380
- Extension ("clr" , sources = sources )
383
+ Extension ("clr" , sources = list ( _get_source_files ()) )
381
384
],
382
385
data_files = [
383
386
("{install_platlib}" , [
0 commit comments