1 |
|
2 |
import os |
3 |
from distutils.core import setup, Extension |
4 |
|
5 |
# try to determine the directory where the shapelib source files are. |
6 |
# There are currently two supported situations. |
7 |
# |
8 |
# 1. "Standalone" build: the parent directory is the shapelib source |
9 |
# directory |
10 |
# 2. Built in the Thuban source tree where it's ../shapelib/ relative to |
11 |
# the directory containing this setup.py |
12 |
|
13 |
# os.path expects filenames in OS-specific form so we have to construct |
14 |
# the files with os.path functions. distutils, OTOH, uses posix-style |
15 |
# filenames exclusively, so we posix when making filenames for |
16 |
# distutils. |
17 |
if os.path.exists(os.path.join(os.pardir, "shpeopen.c")): |
18 |
shp_dir = ".." |
19 |
elif os.path.exists(os.path.join(os.pardir, "shapelib")): |
20 |
shp_dir = "../shapelib" |
21 |
|
22 |
extensions = [Extension("shapelibc", |
23 |
["shapelib_wrap.c", |
24 |
shp_dir + "/shpopen.c", |
25 |
shp_dir + "/shptree.c"], |
26 |
include_dirs = [shp_dir]), |
27 |
Extension("shptree", |
28 |
["shptreemodule.c"], |
29 |
include_dirs = [shp_dir]), |
30 |
Extension("dbflibc", |
31 |
["dbflib_wrap.c", |
32 |
shp_dir + "/dbfopen.c"], |
33 |
include_dirs = [shp_dir])] |
34 |
|
35 |
setup(name = "pyshapelib", |
36 |
version = "0.3", |
37 |
description = "Python bindings for shapelib", |
38 |
author = "Bernhard Herzog", |
39 |
author_email = "[email protected]", |
40 |
url = "ftp:intevation.de/users/bh", |
41 |
py_modules = ["shapelib", "dbflib"], |
42 |
ext_modules = extensions) |
43 |
|