From 3c6ffb00a5cc8d51970ce394a572566f31326b03 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 6 Sep 2018 16:51:48 +0300 Subject: [PATCH] Allow to install the library on systems without compilation toolset --- setup.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 343dbb18d..f2bf8819f 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import codecs +import pathlib from itertools import islice import os import platform @@ -11,6 +12,7 @@ PYPY = platform.python_implementation() == 'PyPy' +here = pathlib.Path(__file__).parent # Fallbacks for PyPy: don't use C extensions @@ -24,6 +26,13 @@ except ImportError: USE_CYTHON = False + if (here / '.git').exists() and not USE_CYTHON: + print("Install cython when building from git clone", + file=sys.stderr) + print("Hint:", file=sys.stderr) + print(" pip install cython", file=sys.stderr) + sys.exit(1) + ext = '.pyx' if USE_CYTHON else '.c' if bool(os.environ.get('PROFILE_BUILD')): @@ -74,7 +83,7 @@ def run(self): def build_extension(self, ext): try: build_ext.build_extension(self, ext) - except (DistutilsExecError, + except (CompilerError, DistutilsExecError, DistutilsPlatformError, ValueError): raise BuildFailed()