Menu

[r1646]: / trunk / toolkits / basemap / setup.py  Maximize  Restore  History

Download this file

65 lines (56 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from distutils.core import setup, Extension
from distutils.util import convert_path
import sys, glob
def dbf_macros():
"""Return the macros to define when compiling the dbflib wrapper.
The returned list specifies one macro, HAVE_UPDATE_HEADER, which is
'1' if the dbflib version we will be compiling with has the
DBFUpdateHeader function and '0' otherwise. To check whether
DBFUpdateHeader is available, we scan shapefil.h for the string
'DBFUpdateHeader'.
"""
f = open(convert_path("pyshapelib/shapelib/shapefil.h"))
contents = f.read()
f.close()
if contents.find("DBFUpdateHeader") >= 0:
return [("HAVE_UPDATE_HEADER", "1")]
else:
return [("HAVE_UPDATE_HEADER", "0")]
deps = glob.glob('src/*.c')
extensions = [Extension("proj4",deps,include_dirs = ['src'],)]
packages = ['matplotlib/toolkits','matplotlib/toolkits/basemap']
package_dirs = {'':'lib'}
# don't build pyshapelib if it is already installed.
try:
import shapelib
import dbflib
except:
packages = packages + ['shapelib','dbflib']
package_dirs['shapelib'] ='pyshapelib/lib/shapelib'
package_dirs['dbflib'] ='pyshapelib/lib/dbflib'
extensions = extensions + \
[Extension("shapelibc",
["pyshapelib/shapelib_wrap.c",
"pyshapelib/shapelib/shpopen.c",
"pyshapelib/shapelib/shptree.c"],
include_dirs = ["pyshapelib/shapelib"]),
Extension("shptree",
["pyshapelib/shptreemodule.c"],
include_dirs = ["pyshapelib/shapelib"]),
Extension("dbflibc",
["pyshapelib/dbflib_wrap.c",
"pyshapelib/shapelib/dbfopen.c"],
include_dirs = ["pyshapelib/shapelib"],
define_macros = dbf_macros()) ]
datadir ='share/basemap-py'+repr(sys.version_info[0])+repr(sys.version_info[1])
setup(
name = "basemap",
version = "0.6.1",
description = "Plot data on map projections with matplotlib",
url = "http://matplotlib.sourceforge.net/toolkits.html",
author = "Jeff Whitaker",
author_email = "jeffrey.s.whitaker@noaa.gov",
data_files = [(datadir,['data/countries_c.txt','data/states_c.txt','data/countries_l.txt','data/states_l.txt','data/gshhs_c.txt','data/gshhs_l.txt','data/countries_i.txt','data/states_i.txt','data/gshhs_i.txt'])],
packages = packages,
package_dir = package_dirs,
ext_modules = extensions)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.