11from __future__ import (absolute_import , division , print_function )
22
3- import sys , glob , os , subprocess
3+ import glob
4+ import io
5+ import os
6+ import sys
7+ from setuptools .dist import Distribution
48
59if sys .version_info < (2 , 6 ):
610 raise SystemExit ("""matplotlib and the basemap toolkit require Python 2.6 or later.""" )
711
8- from distutils .dist import Distribution
9- from distutils .util import convert_path
10- from distutils import ccompiler , sysconfig
11-
1212# Do not require numpy for just querying the package
1313# Taken from the netcdf-python setup file (which took it from h5py setup file).
1414inc_dirs = []
1515if any ('--' + opt in sys .argv for opt in Distribution .display_option_names +
1616 ['help-commands' , 'help' ]) or sys .argv [1 ] == 'egg_info' :
17- from distutils . core import setup , Extension
17+ from setuptools import setup , Extension
1818else :
1919 import numpy
2020 # Use numpy versions if they are available.
2323 inc_dirs .append (numpy .get_include ())
2424
2525
26+ def get_install_requirements (path ):
27+ path = os .path .join (os .path .dirname (__file__ ), path )
28+ with io .open (path , encoding = 'utf-8' ) as fp :
29+ content = fp .read ()
30+ return [req for req in content .split ("\n " )
31+ if req != '' and not req .startswith ('#' )]
32+
33+
2634def checkversion (GEOS_dir ):
2735 """check geos C-API header file (geos_c.h)"""
2836 try :
@@ -106,13 +114,7 @@ def checkversion(GEOS_dir):
106114datafiles = [os .path .join ('data' ,os .path .basename (f )) for f in datafiles ]
107115package_data = {'mpl_toolkits.basemap' :datafiles }
108116
109- requirements = [
110- "numpy>=1.2.1" ,
111- "matplotlib>=1.0.0" ,
112- "pyproj >= 1.9.3" ,
113- "pyshp >= 1.2.0" ,
114- "six" ,
115- ]
117+ install_requires = get_install_requirements ("requirements.txt" )
116118
117119__version__ = "1.1.0"
118120setup (
@@ -130,7 +132,7 @@ def checkversion(GEOS_dir):
130132 author_email = "[email protected] " ,
131133 maintainer = "Ben Root" ,
132134 maintainer_email = "[email protected] " ,
133- install_requires = requirements ,
135+ install_requires = install_requires ,
134136 platforms = ["any" ],
135137 license = "OSI Approved" ,
136138 keywords = ["python" ,"plotting" ,"plots" ,"graphs" ,"charts" ,"GIS" ,"mapping" ,"map projections" ,"maps" ],
@@ -145,6 +147,6 @@ def checkversion(GEOS_dir):
145147 packages = packages ,
146148 namespace_packages = namespace_packages ,
147149 package_dir = package_dirs ,
148- ext_modules = extensions ,
150+ ext_modules = extensions ,
149151 package_data = package_data
150152 )
0 commit comments