1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
1
4
"""
2
5
Setup script for building clr.pyd and dependencies using mono and into
3
6
an egg or wheel.
4
7
"""
8
+
5
9
from setuptools import setup , Extension
6
10
from distutils .command .build_ext import build_ext
7
11
from distutils .command .install_lib import install_lib
23
27
24
28
25
29
def _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"""
27
31
path = find_executable (tool )
28
32
if path :
29
33
return path
@@ -82,7 +86,8 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
82
86
finally :
83
87
hreg .Close ()
84
88
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
86
91
if use_windows_sdk :
87
92
localappdata = os .environ ["LOCALAPPDATA" ]
88
93
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):
110
115
_config = "%sMono" % CONFIG
111
116
112
117
else :
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 )
114
120
115
121
116
122
class PythonNET_BuildExt (build_ext ):
117
123
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"""
121
125
if ext .name != "clr" :
122
126
return build_ext .build_extension (self , ext )
123
127
@@ -129,8 +133,8 @@ def build_extension(self, ext):
129
133
if not os .path .exists (dest_dir ):
130
134
os .makedirs (dest_dir )
131
135
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.
134
138
if sys .version_info [:2 ] <= (3 , 2 ):
135
139
unicode_width = 2 if sys .maxunicode < 0x10FFFF else 4
136
140
else :
@@ -204,7 +208,8 @@ def _get_manifest(self, build_dir):
204
208
if DEVTOOLS == "MsDev" and sys .version_info [:2 ] > (2 , 5 ):
205
209
mt = _find_msbuild_tool ("mt.exe" , use_windows_sdk = True )
206
210
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 ]
208
213
self .announce ("Extracting manifest from %s" % sys .executable )
209
214
check_call (" " .join (cmd ), shell = False )
210
215
return manifest
@@ -282,8 +287,7 @@ def run(self):
282
287
283
288
def _check_output (* popenargs , ** kwargs ):
284
289
"""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.
287
291
"""
288
292
process = Popen (stdout = PIPE , * popenargs , ** kwargs )
289
293
output , unused_err = process .communicate ()
@@ -304,7 +308,7 @@ def _get_interop_filename():
304
308
as most windows users won't have Clang installed, which is
305
309
required to generate the file.
306
310
"""
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" , "" ))
308
312
return os .path .join ("src" , "runtime" , interop_file )
309
313
310
314
@@ -336,18 +340,21 @@ def _get_interop_filename():
336
340
name = "pythonnet" ,
337
341
version = "2.2.0" ,
338
342
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" ,
341
346
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' ,
342
352
'Programming Language :: Python :: 2.7' ,
353
+ 'Programming Language :: Python :: 3' ,
343
354
'Programming Language :: Python :: 3.3' ,
344
355
'Programming Language :: Python :: 3.4' ,
345
356
'Programming Language :: Python :: 3.5' ,
346
357
'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' ,
351
358
'Operating System :: Microsoft :: Windows' ,
352
359
'Operating System :: POSIX :: Linux' ,
353
360
'Operating System :: MacOS :: MacOS X' ,
0 commit comments