summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-01-29 15:12:04 +0900
committerINADA Naoki <inada-n@klab.com>2013-01-29 15:12:04 +0900
commit86983e27bc809bd2f25a0ad61ffacb978b1c1ad9 (patch)
tree24c0a910ad8f4bf328a95a532e14591bdd672636 /setup.py
parent5f55e4c6dbc3ec723bea5b9fead2e36224e70b81 (diff)
parent8d6a387dff10dd2150aa86cd96e2bece26546268 (diff)
downloadmsgpack-python-86983e27bc809bd2f25a0ad61ffacb978b1c1ad9.tar.gz
Add purepython fallback. (Merge branch 'purepython')
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index ac3eeb5..d4808d6 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,9 @@ from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
+class NoCython(Exception):
+ pass
+
try:
import Cython.Compiler.Main as cython_compiler
have_cython = True
@@ -24,10 +27,7 @@ def ensure_source(src):
if not os.path.exists(src):
if not have_cython:
- raise Exception("""\
-Cython is required for building extension from checkout.
-Install Cython >= 0.16 or install msgpack from PyPI.
-""")
+ raise NoCython
cythonize(pyx)
elif (os.path.exists(pyx) and
os.stat(src).st_mtime < os.stat(pyx).st_mtime and
@@ -38,7 +38,14 @@ Install Cython >= 0.16 or install msgpack from PyPI.
class BuildExt(build_ext):
def build_extension(self, ext):
- ext.sources = list(map(ensure_source, ext.sources))
+ try:
+ ext.sources = list(map(ensure_source, ext.sources))
+ except NoCython:
+ print("WARNING")
+ print("Cython is required for building extension from checkout.")
+ print("Install Cython >= 0.16 or install msgpack from PyPI.")
+ print("Falling back to pure Python implementation.")
+ return
return build_ext.build_extension(self, ext)