1
1
from __future__ import (absolute_import , division , print_function )
2
2
3
- import sys , glob , os , subprocess
3
+ import glob
4
+ import io
5
+ import os
6
+ import sys
7
+ from setuptools .dist import Distribution
4
8
5
9
if sys .version_info < (2 , 6 ):
6
10
raise SystemExit ("""matplotlib and the basemap toolkit require Python 2.6 or later.""" )
7
11
8
- from distutils .dist import Distribution
9
- from distutils .util import convert_path
10
- from distutils import ccompiler , sysconfig
11
-
12
12
# Do not require numpy for just querying the package
13
13
# Taken from the netcdf-python setup file (which took it from h5py setup file).
14
14
inc_dirs = []
15
15
if any ('--' + opt in sys .argv for opt in Distribution .display_option_names +
16
16
['help-commands' , 'help' ]) or sys .argv [1 ] == 'egg_info' :
17
- from distutils . core import setup , Extension
17
+ from setuptools import setup , Extension
18
18
else :
19
19
import numpy
20
20
# Use numpy versions if they are available.
23
23
inc_dirs .append (numpy .get_include ())
24
24
25
25
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
+
26
34
def checkversion (GEOS_dir ):
27
35
"""check geos C-API header file (geos_c.h)"""
28
36
try :
@@ -106,13 +114,7 @@ def checkversion(GEOS_dir):
106
114
datafiles = [os .path .join ('data' ,os .path .basename (f )) for f in datafiles ]
107
115
package_data = {'mpl_toolkits.basemap' :datafiles }
108
116
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" )
116
118
117
119
__version__ = "1.1.0"
118
120
setup (
@@ -130,7 +132,7 @@ def checkversion(GEOS_dir):
130
132
author_email = "jeffrey.s.whitaker@noaa.gov" ,
131
133
maintainer = "Ben Root" ,
132
134
maintainer_email = "ben.v.root@gmail.com" ,
133
- install_requires = requirements ,
135
+ install_requires = install_requires ,
134
136
platforms = ["any" ],
135
137
license = "OSI Approved" ,
136
138
keywords = ["python" ,"plotting" ,"plots" ,"graphs" ,"charts" ,"GIS" ,"mapping" ,"map projections" ,"maps" ],
@@ -145,6 +147,6 @@ def checkversion(GEOS_dir):
145
147
packages = packages ,
146
148
namespace_packages = namespace_packages ,
147
149
package_dir = package_dirs ,
148
- ext_modules = extensions ,
150
+ ext_modules = extensions ,
149
151
package_data = package_data
150
152
)
0 commit comments