150150def _check_output (* args , ** kwargs ):
151151 """Check output wrapper for py2/py3 compatibility"""
152152 output = subprocess .check_output (* args , ** kwargs )
153- if PY_MAJOR == 2 :
154- return output
155153 return output .decode ("ascii" )
156154
157155
@@ -255,17 +253,11 @@ def build_extension(self, ext):
255253
256254 # Up to Python 3.2 sys.maxunicode is used to determine the size of
257255 # Py_UNICODE, but from 3.3 onwards Py_UNICODE is a typedef of wchar_t.
258- # TODO: Is this doing the right check for Py27?
259- if sys .version_info [:2 ] <= (3 , 2 ):
260- unicode_width = 2 if sys .maxunicode < 0x10FFFF else 4
261- else :
262- import ctypes
263-
264- unicode_width = ctypes .sizeof (ctypes .c_wchar )
256+ import ctypes
257+ unicode_width = ctypes .sizeof (ctypes .c_wchar )
265258
266259 defines = [
267260 "PYTHON{0}{1}" .format (PY_MAJOR , PY_MINOR ),
268- "PYTHON{0}" .format (PY_MAJOR ), # Python Major Version
269261 "UCS{0}" .format (unicode_width ),
270262 ]
271263
@@ -274,7 +266,6 @@ def build_extension(self, ext):
274266
275267 if sys .platform != "win32" and (DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" ):
276268 on_darwin = sys .platform == "darwin"
277- defines .append ("MONO_OSX" if on_darwin else "MONO_LINUX" )
278269
279270 # Check if --enable-shared was set when Python was built
280271 enable_shared = sysconfig .get_config_var ("Py_ENABLE_SHARED" )
@@ -288,6 +279,9 @@ def build_extension(self, ext):
288279 if not enable_shared :
289280 defines .append ("PYTHON_WITHOUT_ENABLE_SHARED" )
290281
282+ if sys .platform == "win32" :
283+ defines .append ("WINDOWS" )
284+
291285 if hasattr (sys , "abiflags" ):
292286 if "d" in sys .abiflags :
293287 defines .append ("PYTHON_WITH_PYDEBUG" )
@@ -479,10 +473,7 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
479473 return path
480474
481475 # Search within registry to find build tools
482- try : # PY2
483- import _winreg as winreg
484- except ImportError : # PY3
485- import winreg
476+ import winreg
486477
487478 _collect_installed_windows_kits_v10 (winreg )
488479
@@ -645,8 +636,6 @@ def run(self):
645636 "Intended Audience :: Developers" ,
646637 "License :: OSI Approved :: MIT License" ,
647638 "Programming Language :: C#" ,
648- "Programming Language :: Python :: 2" ,
649- "Programming Language :: Python :: 2.7" ,
650639 "Programming Language :: Python :: 3" ,
651640 "Programming Language :: Python :: 3.5" ,
652641 "Programming Language :: Python :: 3.6" ,
0 commit comments