diff options
author | David Cournapeau <cournape@gmail.com> | 2009-09-14 09:22:11 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-09-14 09:22:11 +0000 |
commit | 5b15eb7bbe9d1b0b23fc3d9709ed2c311d069f9c (patch) | |
tree | e397a9db764326f16edc3bf3cd593a6bc43d9c89 /numpy/distutils/command/build_src.py | |
parent | dbd30d1c3e5ce7873049779211f8d6805377dd88 (diff) | |
download | numpy-5b15eb7bbe9d1b0b23fc3d9709ed2c311d069f9c.tar.gz |
Do not import pyrex in distutils unless there are some pyrex source files.
Diffstat (limited to 'numpy/distutils/command/build_src.py')
-rw-r--r-- | numpy/distutils/command/build_src.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py index 818bd52fd..27d9d427f 100644 --- a/numpy/distutils/command/build_src.py +++ b/numpy/distutils/command/build_src.py @@ -12,11 +12,12 @@ from distutils.dep_util import newer_group, newer from distutils.util import get_platform from distutils.errors import DistutilsError, DistutilsSetupError -try: - import Pyrex.Compiler.Main - have_pyrex = True -except ImportError: - have_pyrex = False +def have_pyrex(): + try: + import Pyrex.Compiler.Main + return True + except ImportError: + return False # this import can't be done here, as it uses numpy stuff only available # after it's installed @@ -462,14 +463,15 @@ class build_src(build_ext.build_ext): return new_sources def generate_a_pyrex_source(self, base, ext_name, source, extension): - if self.inplace or not have_pyrex: + if self.inplace or not have_pyrex(): target_dir = os.path.dirname(base) else: target_dir = appendpath(self.build_src, os.path.dirname(base)) target_file = os.path.join(target_dir, ext_name + '.c') depends = [source] + extension.depends if self.force or newer_group(depends, target_file, 'newer'): - if have_pyrex: + if have_pyrex(): + import Pyrex.Compiler.Main log.info("pyrexc:> %s" % (target_file)) self.mkpath(target_dir) options = Pyrex.Compiler.Main.CompilationOptions( |