Permalink
Browse files

BLD: don't require Cython to be installed for each Python version.

  • Loading branch information...
1 parent 0493cf3 commit 29dd727a6a37bc70063be9aa1a3f16052c64c780 @rgommers rgommers committed with pv Jan 24, 2013
Showing with 13 additions and 16 deletions.
  1. +13 −16 tools/cythonize.py
View
@@ -36,9 +36,7 @@
import re
import sys
import hashlib
-import pickle
import subprocess
-from subprocess import Popen, PIPE
HASH_FILE = 'cythonize.dat'
DEFAULT_ROOT = 'scipy'
@@ -48,25 +46,24 @@
#
def process_pyx(fromfile, tofile):
try:
- import Cython
- except ImportError:
- raise OSError('Cython needs to be installed')
- from Cython.Compiler.Version import version as cython_version
- from distutils.version import LooseVersion
+ from Cython.Compiler.Version import version as cython_version
+ from distutils.version import LooseVersion
+ if LooseVersion(cython_version) < LooseVersion('0.17'):
+ raise Exception('Building SciPy requires Cython >= 0.17')
- HAVE_CYTHON_0p14 = LooseVersion(cython_version) >= LooseVersion('0.14')
-
- if HAVE_CYTHON_0p14:
- flags = ['--fast-fail']
- else:
- flags = ['']
+ except ImportError:
+ pass
+ flags = ['--fast-fail']
if tofile.endswith('.cxx'):
flags += ['--cplus']
- r = subprocess.call(['cython'] + flags + ["-o", tofile, fromfile])
- if r != 0:
- raise Exception('Cython failed')
+ try:
+ r = subprocess.call(['cython'] + flags + ["-o", tofile, fromfile])
+ if r != 0:
+ raise Exception('Cython failed')
+ except OSError:
+ raise OSError('Cython needs to be installed')
def process_tempita_pyx(fromfile, tofile):
import tempita

0 comments on commit 29dd727

Please sign in to comment.