Skip to content

Commit

Permalink
Allow to install the library on systems without compilation toolset
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Sep 6, 2018
1 parent 1e90d50 commit 3c6ffb0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup.py
@@ -1,4 +1,5 @@
import codecs
import pathlib
from itertools import islice
import os
import platform
Expand All @@ -11,6 +12,7 @@


PYPY = platform.python_implementation() == 'PyPy'
here = pathlib.Path(__file__).parent


# Fallbacks for PyPy: don't use C extensions
Expand All @@ -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')):
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 3c6ffb0

Please sign in to comment.