Skip to content

Commit d9f2632

Browse files
committed
fixed issue when numpy is not yet installed for a fresh install
1 parent 1a2dded commit d9f2632

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

setup.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
from distutils.extension import Extension
55
from warnings import warn
66

7-
try:
7+
try: # numpy and cython installed
88
from Cython.Build import cythonize
99
# If we successfully imported Cython, look for a .pyx file
1010
import numpy
1111
ext_modules = cythonize('dataRead.pyx', include_path=[numpy.get_include()], gdb_debug=True)
12-
except:
12+
except ImportError:
1313
# If we couldn't import Cython, use the normal setuptools
1414
# and look for a pre-compiled .c file instead of a .pyx file
1515
from setuptools.command.build_ext import build_ext
@@ -57,7 +57,8 @@
5757
'Programming Language :: Python :: 2.7',
5858
'Programming Language :: Python :: 3.4',
5959
'Programming Language :: Python :: 3.5',
60-
'Programming Language :: Python :: 3.6'
60+
'Programming Language :: Python :: 3.6',
61+
'Programming Language :: Python :: 3.7'
6162
]
6263

6364
# What does your project relate to?
@@ -103,20 +104,20 @@
103104
entry_points = {
104105
'console_scripts': ['mdfconverter=mdfconverter.mdfconverter:main', ],
105106
}
106-
print(ext_modules)
107-
try: # try compiling module with cython or c code
107+
108+
try: # try compiling module with cython or c code with numpy and cython already installed
108109
setup(name=name, version=version, description=description, long_description=long_description,
109110
url=url, author=author, author_email=author_email, license=license, classifiers=classifiers,
110111
keywords=keywords, packages=packages, install_requires=install_requires, extras_require=extras_require,
111112
entry_points=entry_points, ext_modules=ext_modules, include_dirs=[numpy.get_include()])
112-
except: # without Cython
113+
except: # could not compile extension dataRead
113114
import sys
114115
print("Unexpected error:", sys.exc_info())
115116
extras_require.pop('experimental')
116117
install_requires.append('bitarray') # replaces cython requirement by bitarray
117118
setup(name=name, version=version, description=description, long_description=long_description,
118119
url=url, author=author, author_email=author_email, license=license, classifiers=classifiers,
119120
keywords=keywords, packages=packages, install_requires=install_requires, extras_require=extras_require,
120-
entry_points=entry_points, include_dirs=[numpy.get_include()])
121+
entry_points=entry_points)
121122
warn('It is strongly advised to install Cython along with compilation environment '
122123
'for performance and robustness purpose')

0 commit comments

Comments
 (0)