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.""" )
21
25
inc_dirs .append (numpy .get_include ())
22
26
23
27
28
+ def read (path , encoding = 'utf-8' ):
29
+ path = os .path .join (os .path .dirname (__file__ ), path )
30
+ with io .open (path , encoding = encoding ) as fp :
31
+ return fp .read ()
32
+
33
+
34
+ def get_install_requirements (path ):
35
+ content = read (path )
36
+ return [
37
+ req
38
+ for req in content .split ("\n " )
39
+ if req != '' and not req .startswith ('#' )
40
+ ]
41
+
42
+
24
43
def checkversion (GEOS_dir ):
25
44
"""check geos C-API header file (geos_c.h)"""
26
45
try :
@@ -104,13 +123,7 @@ def checkversion(GEOS_dir):
104
123
datafiles = [os .path .join ('data' ,os .path .basename (f )) for f in datafiles ]
105
124
package_data = {'mpl_toolkits.basemap' :datafiles }
106
125
107
- requirements = [
108
- "numpy>=1.2.1" ,
109
- "matplotlib>=1.0.0" ,
110
- "pyproj >= 1.9.3" ,
111
- "pyshp >= 1.2.0" ,
112
- "six" ,
113
- ]
126
+ install_requires = get_install_requirements ("requirements.txt" )
114
127
115
128
__version__ = "1.1.0"
116
129
setup (
@@ -128,7 +141,7 @@ def checkversion(GEOS_dir):
128
141
author_email = "[email protected] " ,
129
142
maintainer = "Ben Root" ,
130
143
maintainer_email = "[email protected] " ,
131
- install_requires = requirements ,
144
+ install_requires = install_requires ,
132
145
platforms = ["any" ],
133
146
license = "OSI Approved" ,
134
147
keywords = ["python" ,"plotting" ,"plots" ,"graphs" ,"charts" ,"GIS" ,"mapping" ,"map projections" ,"maps" ],
@@ -143,6 +156,6 @@ def checkversion(GEOS_dir):
143
156
packages = packages ,
144
157
namespace_packages = namespace_packages ,
145
158
package_dir = package_dirs ,
146
- ext_modules = extensions ,
159
+ ext_modules = extensions ,
147
160
package_data = package_data
148
161
)
0 commit comments