From 564f9ba9df3c6837b102f370ad32a65c233c209f Mon Sep 17 00:00:00 2001 From: Dan Meliza Date: Mon, 2 Oct 2017 12:15:36 -0400 Subject: defer numpy import to allow install_requires to do its job (fixes #24) --- setup.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b53304b..76a27e4 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,6 @@ Distributed under the BSD License from setuptools import setup, find_packages from distutils.extension import Extension import os.path -import numpy try: from Cython.Distutils import build_ext @@ -21,6 +20,14 @@ except ImportError: else: use_cython = True + +class numpy_include(object): + """Defers import of numpy until install_requires is through""" + def __str__(self): + import numpy + return numpy.get_include() + + if os.path.isfile("pyspike/cython/cython_add.c") and \ os.path.isfile("pyspike/cython/cython_profiles.c") and \ os.path.isfile("pyspike/cython/cython_distances.c"): @@ -58,7 +65,7 @@ setup( version='0.5.1', cmdclass=cmdclass, ext_modules=ext_modules, - include_dirs=[numpy.get_include()], + include_dirs=[numpy_include()], description='A Python library for the numerical analysis of spike\ train similarity', author='Mario Mulansky', -- cgit v1.2.3