diff --git a/requirements.txt b/requirements.txt index 5f37c2518..97fdf7326 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +matplotlib>=1.0.0 +numpy>=1.2.1 pyproj>=1.9.3 pyshp>=1.2.0 six diff --git a/setup.py b/setup.py index 4281753ad..5afc9994f 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,20 @@ from __future__ import (absolute_import, division, print_function) -import sys, glob, os, subprocess +import glob +import io +import os +import sys +from setuptools.dist import Distribution if sys.version_info < (2, 6): raise SystemExit("""matplotlib and the basemap toolkit require Python 2.6 or later.""") -from distutils.dist import Distribution -from distutils.util import convert_path -from distutils import ccompiler, sysconfig - # Do not require numpy for just querying the package # Taken from the netcdf-python setup file (which took it from h5py setup file). inc_dirs = [] if any('--' + opt in sys.argv for opt in Distribution.display_option_names + ['help-commands', 'help']) or sys.argv[1] == 'egg_info': - from distutils.core import setup, Extension + from setuptools import setup, Extension else: import numpy # Use numpy versions if they are available. @@ -23,6 +23,14 @@ inc_dirs.append(numpy.get_include()) +def get_install_requirements(path): + path = os.path.join(os.path.dirname(__file__), path) + with io.open(path, encoding='utf-8') as fp: + content = fp.read() + return [req for req in content.split("\n") + if req != '' and not req.startswith('#')] + + def checkversion(GEOS_dir): """check geos C-API header file (geos_c.h)""" try: @@ -106,13 +114,7 @@ def checkversion(GEOS_dir): datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles] package_data = {'mpl_toolkits.basemap':datafiles} -requirements = [ - "numpy>=1.2.1", - "matplotlib>=1.0.0", - "pyproj >= 1.9.3", - "pyshp >= 1.2.0", - "six", -] +install_requires = get_install_requirements("requirements.txt") __version__ = "1.1.0" setup( @@ -130,7 +132,7 @@ def checkversion(GEOS_dir): author_email = "jeffrey.s.whitaker@noaa.gov", maintainer = "Ben Root", maintainer_email = "ben.v.root@gmail.com", - install_requires = requirements, + install_requires = install_requires, platforms = ["any"], license = "OSI Approved", keywords = ["python","plotting","plots","graphs","charts","GIS","mapping","map projections","maps"], @@ -145,6 +147,6 @@ def checkversion(GEOS_dir): packages = packages, namespace_packages = namespace_packages, package_dir = package_dirs, - ext_modules = extensions, + ext_modules = extensions, package_data = package_data )