Commit 2cde914c authored by Jason R. Coombs's avatar Jason R. Coombs

Use six for python major version detection

parent 097e92ab
import sys
import distutils.command.build_ext as orig
from distutils.sysconfig import get_config_var
from setuptools.extern import six
from setuptools.command.build_ext import build_ext, get_abi3_suffix
from setuptools.dist import Distribution
from setuptools.extension import Extension
......@@ -27,7 +29,7 @@ class TestBuildExt:
of Python 3 if 'is_abi3' is truthy on Extension()
"""
print(get_abi3_suffix())
extension = Extension('spam.eggs', ['eggs.c'], py_limited_api=True)
dist = Distribution(dict(ext_modules=[extension]))
cmd = build_ext(dist)
......@@ -35,9 +37,9 @@ class TestBuildExt:
assert 'spam.eggs' in cmd.ext_map
res = cmd.get_ext_filename('spam.eggs')
if sys.version_info[0] == 2 or not get_abi3_suffix():
if six.PY2 or not get_abi3_suffix():
assert res.endswith(get_config_var('SO'))
elif sys.platform == 'win32':
assert res.endswith('eggs.pyd')
else:
assert 'abi3' in res
\ No newline at end of file
assert 'abi3' in res
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment