mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 18:25:32 +08:00
clean up setup.py according to 9cfaf4a
- cython added to setup_requirements - setuptools will call easy_install to install it - all other build requirements, excluding numpy, will be resolved by pip - do not parse requirements.txt - requirements should be the real runtime requirements - fail gracefully when missing numpy - scipy will be resolved by pip from install_requires
This commit is contained in:
@@ -34,24 +34,10 @@ with open('skimage/__init__.py') as fid:
|
||||
with open('requirements.txt') as fid:
|
||||
INSTALL_REQUIRES = [l.strip() for l in fid.readlines() if l]
|
||||
|
||||
# development versions do not have the cythonized files
|
||||
if VERSION.endswith('dev'):
|
||||
SETUP_REQUIRES = [r for r in INSTALL_REQUIRES if r.startswith('cython')]
|
||||
else:
|
||||
INSTALL_REQUIRES = [r for r in INSTALL_REQUIRES
|
||||
if not r.startswith('cython')]
|
||||
SETUP_REQUIRES = []
|
||||
|
||||
|
||||
# list requirements for PyPI
|
||||
REQUIRES = [r.replace('>=', ' (>= ') + ')'
|
||||
for r in INSTALL_REQUIRES + SETUP_REQUIRES]
|
||||
# requirements for those browsing PyPI
|
||||
REQUIRES = [r.replace('>=', ' (>= ') + ')' for r in INSTALL_REQUIRES]
|
||||
REQUIRES = [r.replace('==', ' (== ') for r in REQUIRES]
|
||||
|
||||
|
||||
# do not attempt to install numpy and scipy until they have eggs available
|
||||
INSTALL_REQUIRES = [r for r in INSTALL_REQUIRES
|
||||
if not r.startswith(('scipy', 'numpy'))]
|
||||
REQUIRES = [r.replace('[array]', '') for r in REQUIRES]
|
||||
|
||||
|
||||
def configuration(parent_package='', top_path=None):
|
||||
@@ -73,9 +59,17 @@ def configuration(parent_package='', top_path=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# purposely fail loudly if numpy or scipy are not available
|
||||
from numpy.distutils.core import setup
|
||||
import scipy
|
||||
# purposely fail if numpy is not available
|
||||
# other dependecies will be resolved by pip (install_requires)
|
||||
try:
|
||||
from numpy.distutils.core import setup
|
||||
except ImportError:
|
||||
print('To install scikit-image from source, you will need numpy.\n' +
|
||||
'Install numpy with pip:\n' +
|
||||
'pip install numpy\n'
|
||||
'Or use your operating system package manager. For more\n' +
|
||||
'details, see http://scikit-image.org/docs/stable/install.html')
|
||||
sys.exit(1)
|
||||
|
||||
setup(
|
||||
name=DISTNAME,
|
||||
@@ -105,8 +99,9 @@ if __name__ == "__main__":
|
||||
],
|
||||
|
||||
configuration=configuration,
|
||||
setup_requires=SETUP_REQUIRES,
|
||||
install_requires=INSTALL_REQUIRES,
|
||||
# install cython when running setup.py (source install)
|
||||
setup_requires=['cython>=0.21'],
|
||||
requires=REQUIRES,
|
||||
packages=setuptools.find_packages(exclude=['doc']),
|
||||
include_package_data=True,
|
||||
|
||||
Reference in New Issue
Block a user