23
23
CONFIG = "Release" # Release or Debug
24
24
DEVTOOLS = "MsDev" if sys .platform == "win32" else "Mono"
25
25
VERBOSITY = "minimal" # quiet, minimal, normal, detailed, diagnostic
26
- PLATFORM = "x64" if architecture ()[0 ] == "64bit" else "x86"
26
+ ARCH = "x64" if architecture ()[0 ] == "64bit" else "x86"
27
27
28
28
29
29
def _find_msbuild_tool (tool = "msbuild.exe" , use_windows_sdk = False ):
@@ -41,7 +41,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
41
41
if use_windows_sdk :
42
42
sdks_root = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows"
43
43
kits_root = r"SOFTWARE\Microsoft\Windows Kits\Installed Roots"
44
- kits_suffix = os .path .join ("bin" , PLATFORM )
44
+ kits_suffix = os .path .join ("bin" , ARCH )
45
45
keys_to_check .extend ([
46
46
("Windows Kit 10.0" , kits_root , "KitsRoot10" , kits_suffix ),
47
47
("Windows Kit 8.1" , kits_root , "KitsRoot81" , kits_suffix ),
@@ -91,7 +91,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
91
91
if use_windows_sdk :
92
92
localappdata = os .environ ["LOCALAPPDATA" ]
93
93
pywinsdk = localappdata + r"\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin"
94
- if PLATFORM == "x64" :
94
+ if ARCH == "x64" :
95
95
pywinsdk += r"\x64"
96
96
paths_to_check .append (("Visual C++ for Python" , pywinsdk ))
97
97
@@ -119,7 +119,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
119
119
"DevTools %s not supported (use MsDev or Mono)" % DEVTOOLS )
120
120
121
121
122
- class PythonNET_BuildExt (build_ext ):
122
+ class BuildExtPythonnet (build_ext ):
123
123
def build_extension (self , ext ):
124
124
"""Builds the .pyd file using msbuild or xbuild"""
125
125
if ext .name != "clr" :
@@ -185,7 +185,7 @@ def build_extension(self, ext):
185
185
_xbuild ,
186
186
"pythonnet.sln" ,
187
187
"/p:Configuration=%s" % _config ,
188
- "/p:Platform=%s" % PLATFORM ,
188
+ "/p:Platform=%s" % ARCH ,
189
189
"/p:DefineConstants=\" %s\" " % _defines_sep .join (defines ),
190
190
"/p:PythonBuildDir=\" %s\" " % os .path .abspath (dest_dir ),
191
191
"/p:PythonInteropFile=\" %s\" " % os .path .basename (interop_file ),
@@ -250,7 +250,7 @@ def _install_packages(self):
250
250
check_call (cmd , shell = use_shell )
251
251
252
252
253
- class PythonNET_InstallLib (install_lib ):
253
+ class InstallLibPythonnet (install_lib ):
254
254
def install (self ):
255
255
if not os .path .isdir (self .build_dir ):
256
256
self .warn ("'%s' does not exist -- no Python modules to install" %
@@ -262,16 +262,18 @@ def install(self):
262
262
263
263
# only copy clr.pyd/.so
264
264
for srcfile in glob (os .path .join (self .build_dir , "clr.*" )):
265
- destfile = os .path .join (self .install_dir , os .path .basename (srcfile ))
265
+ destfile = os .path .join (
266
+ self .install_dir , os .path .basename (srcfile ))
266
267
self .copy_file (srcfile , destfile )
267
268
268
269
269
- class PythonNET_InstallData (install_data ):
270
+ class InstallDataPythonnet (install_data ):
270
271
def run (self ):
271
272
build_cmd = self .get_finalized_command ("build_ext" )
272
273
install_cmd = self .get_finalized_command ("install" )
273
274
build_lib = os .path .abspath (build_cmd .build_lib )
274
- install_platlib = os .path .relpath (install_cmd .install_platlib , self .install_dir )
275
+ install_platlib = os .path .relpath (
276
+ install_cmd .install_platlib , self .install_dir )
275
277
276
278
for i , data_files in enumerate (self .data_files ):
277
279
if isinstance (data_files , str ):
@@ -313,7 +315,8 @@ def _get_interop_filename():
313
315
sources .extend (glob ("*" + ext ))
314
316
315
317
for root , dirnames , filenames in os .walk ("src" ):
316
- for ext in (".cs" , ".csproj" , ".sln" , ".snk" , ".config" , ".il" , ".py" , ".c" , ".h" , ".ico" ):
318
+ for ext in (".cs" , ".csproj" , ".sln" , ".snk" , ".config" , ".il" ,
319
+ ".py" , ".c" , ".h" , ".ico" ):
317
320
for filename in fnmatch .filter (filenames , "*" + ext ):
318
321
sources .append (os .path .join (root , filename ))
319
322
@@ -360,9 +363,9 @@ def _get_interop_filename():
360
363
],
361
364
zip_safe = False ,
362
365
cmdclass = {
363
- "build_ext" : PythonNET_BuildExt ,
364
- "install_lib" : PythonNET_InstallLib ,
365
- "install_data" : PythonNET_InstallData ,
366
+ "build_ext" : BuildExtPythonnet ,
367
+ "install_lib" : InstallLibPythonnet ,
368
+ "install_data" : InstallDataPythonnet ,
366
369
},
367
370
setup_requires = setup_requires
368
371
)
0 commit comments