1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+
14"""
25Setup script for building clr.pyd and dependencies using mono and into
36an egg or wheel.
47"""
8+
59from setuptools import setup , Extension
610from distutils .command .build_ext import build_ext
711from distutils .command .install_lib import install_lib
2327
2428
2529def _find_msbuild_tool (tool = "msbuild.exe" , use_windows_sdk = False ):
26- """Return full path to one of the microsoft build tools"""
30+ """Return full path to one of the Microsoft build tools"""
2731 path = find_executable (tool )
2832 if path :
2933 return path
@@ -82,7 +86,8 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
8286 finally :
8387 hreg .Close ()
8488
85- # Add Visual C++ for Python as a fallback in case one of the other Windows SDKs isn't installed
89+ # Add Visual C++ for Python as a fall-back in case one
90+ # of the other Windows SDKs isn't installed
8691 if use_windows_sdk :
8792 localappdata = os .environ ["LOCALAPPDATA" ]
8893 pywinsdk = localappdata + r"\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin"
@@ -110,14 +115,13 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
110115 _config = "%sMono" % CONFIG
111116
112117else :
113- raise NotImplementedError ("DevTools %s not supported (use MsDev or Mono)" % DEVTOOLS )
118+ raise NotImplementedError (
119+ "DevTools %s not supported (use MsDev or Mono)" % DEVTOOLS )
114120
115121
116122class PythonNET_BuildExt (build_ext ):
117123 def build_extension (self , ext ):
118- """
119- Builds the .pyd file using msbuild or xbuild.
120- """
124+ """Builds the .pyd file using msbuild or xbuild"""
121125 if ext .name != "clr" :
122126 return build_ext .build_extension (self , ext )
123127
@@ -129,8 +133,8 @@ def build_extension(self, ext):
129133 if not os .path .exists (dest_dir ):
130134 os .makedirs (dest_dir )
131135
132- # Up to Python 3.2 sys.maxunicode is used to determine the size of Py_UNICODE
133- # but from 3.3 onwards Py_UNICODE is a typedef of wchar_t.
136+ # Up to Python 3.2 sys.maxunicode is used to determine the size of
137+ # Py_UNICODE, but from 3.3 onwards Py_UNICODE is a typedef of wchar_t.
134138 if sys .version_info [:2 ] <= (3 , 2 ):
135139 unicode_width = 2 if sys .maxunicode < 0x10FFFF else 4
136140 else :
@@ -204,7 +208,8 @@ def _get_manifest(self, build_dir):
204208 if DEVTOOLS == "MsDev" and sys .version_info [:2 ] > (2 , 5 ):
205209 mt = _find_msbuild_tool ("mt.exe" , use_windows_sdk = True )
206210 manifest = os .path .abspath (os .path .join (build_dir , "app.manifest" ))
207- cmd = [mt , '-inputresource:"%s"' % sys .executable , '-out:"%s"' % manifest ]
211+ cmd = [mt , '-inputresource:"%s"' % sys .executable ,
212+ '-out:"%s"' % manifest ]
208213 self .announce ("Extracting manifest from %s" % sys .executable )
209214 check_call (" " .join (cmd ), shell = False )
210215 return manifest
@@ -282,8 +287,7 @@ def run(self):
282287
283288def _check_output (* popenargs , ** kwargs ):
284289 """subprocess.check_output from python 2.7.
285- Added here to support building for earlier versions
286- of Python.
290+ Added here to support building for earlier versions of Python.
287291 """
288292 process = Popen (stdout = PIPE , * popenargs , ** kwargs )
289293 output , unused_err = process .communicate ()
@@ -304,7 +308,7 @@ def _get_interop_filename():
304308 as most windows users won't have Clang installed, which is
305309 required to generate the file.
306310 """
307- interop_file = "interop%d%s %s.cs" % (sys .version_info [0 ], sys .version_info [1 ], getattr (sys , "abiflags" , "" ))
311+ interop_file = "interop%d%d %s.cs" % (sys .version_info [0 ], sys .version_info [1 ], getattr (sys , "abiflags" , "" ))
308312 return os .path .join ("src" , "runtime" , interop_file )
309313
310314
@@ -336,18 +340,21 @@ def _get_interop_filename():
336340 name = "pythonnet" ,
337341 version = "2.2.0" ,
338342 description = ".Net and Mono integration for Python" ,
339- url = 'http://pythonnet.github.io/' ,
340- author = "Python for .Net developers" ,
343+ url = 'https://pythonnet.github.io/' ,
344+ license = 'MIT' ,
345+ author = "The Python for .Net developers" ,
341346 classifiers = [
347+ 'Development Status :: 5 - Production/Stable' ,
348+ 'Intended Audience :: Developers' ,
349+ 'License :: OSI Approved :: MIT License' ,
350+ 'Programming Language :: C#' ,
351+ 'Programming Language :: Python :: 2' ,
342352 'Programming Language :: Python :: 2.7' ,
353+ 'Programming Language :: Python :: 3' ,
343354 'Programming Language :: Python :: 3.3' ,
344355 'Programming Language :: Python :: 3.4' ,
345356 'Programming Language :: Python :: 3.5' ,
346357 'Programming Language :: Python :: 3.6' ,
347- 'Programming Language :: C#' ,
348- 'License :: OSI Approved :: MIT License' ,
349- 'Development Status :: 5 - Production/Stable' ,
350- 'Intended Audience :: Developers' ,
351358 'Operating System :: Microsoft :: Windows' ,
352359 'Operating System :: POSIX :: Linux' ,
353360 'Operating System :: MacOS :: MacOS X' ,
0 commit comments