summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-11-28 20:23:34 +0900
committerGitHub <noreply@github.com>2019-11-28 20:23:34 +0900
commit891f2d8743857bb75204f96b0469cb2ec90c7f79 (patch)
tree8d5de9611eef84e3643f1f907e5f4a954b8e25fc /setup.py
parentb458e9a6a2cf69e483fa5994d227382c6a01f3c4 (diff)
downloadmsgpack-python-891f2d8743857bb75204f96b0469cb2ec90c7f79.tar.gz
Drop Python 2 support from _cmsgpack (#376)
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/setup.py b/setup.py
index 8b8d7a0..77b81c6 100755
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,11 @@ from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
+
+PYPY = hasattr(sys, "pypy_version_info")
+PY2 = sys.version_info[0] == 2
+
+
# for building transitional package.
TRANSITIONAL = False
@@ -64,14 +69,11 @@ version_str = '.'.join(str(x) for x in version[:3])
if len(version) > 3 and version[3] != 'final':
version_str += version[3]
-# take care of extension modules.
-if have_cython:
- class Sdist(sdist):
- def __init__(self, *args, **kwargs):
- cythonize('msgpack/_cmsgpack.pyx')
- sdist.__init__(self, *args, **kwargs)
-else:
- Sdist = sdist
+# Cython is required for sdist
+class Sdist(sdist):
+ def __init__(self, *args, **kwargs):
+ cythonize('msgpack/_cmsgpack.pyx')
+ sdist.__init__(self, *args, **kwargs)
libraries = []
if sys.platform == 'win32':
@@ -83,7 +85,7 @@ else:
macros = [('__LITTLE_ENDIAN__', '1')]
ext_modules = []
-if not hasattr(sys, 'pypy_version_info'):
+if not PYPY and not PY2:
ext_modules.append(Extension('msgpack._cmsgpack',
sources=['msgpack/_cmsgpack.cpp'],
libraries=libraries,