Skip to content

Commit d7e78f1

Browse files
committed
a bit more information in failure message if GEOS is not found, also
look in $HOME/local for GEOS (a fairly common directory for user space software)
1 parent e234a34 commit d7e78f1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

setup.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ def checkversion(GEOS_dir):
2929
# set GEOS_dir manually here if automatic detection fails.
3030
GEOS_dir = None
3131

32+
user_home = os.path.expanduser('~')
33+
geos_search_locations = [user_home, os.path.join(user_home, 'local'),
34+
'/usr', '/usr/local', '/sw', '/opt', '/opt/local']
35+
3236
if GEOS_dir is None:
3337
# if GEOS_dir not set, check a few standard locations.
34-
GEOS_dirs = [os.path.expanduser('~'),'/usr','/usr/local','/sw','/opt','/opt/local']
38+
GEOS_dirs = geos_search_locations
3539
for direc in GEOS_dirs:
3640
geos_version = checkversion(direc)
3741
sys.stdout.write('checking for GEOS lib in %s ....\n' % direc)
@@ -47,13 +51,16 @@ def checkversion(GEOS_dir):
4751

4852
if GEOS_dir is None:
4953
raise SystemExit("""
50-
Can't find geos library . Please set the
51-
environment variable GEOS_DIR to point to the location
54+
Can't find geos library in standard locations ('%s').
55+
Please install the corresponding packages using your
56+
systems software management system (e.g. for Debian Linux do:
57+
'apt-get install libgeos-3.3.3 libgeos-c1 libgeos-dev' and/or
58+
set the environment variable GEOS_DIR to point to the location
5259
where geos is installed (for example, if geos_c.h
5360
is in /usr/local/include, and libgeos_c is in /usr/local/lib,
5461
set GEOS_DIR to /usr/local), or edit the setup.py script
5562
manually and set the variable GEOS_dir (right after the line
56-
that says "set GEOS_dir manually here".""")
63+
that says "set GEOS_dir manually here".""" % "', '".join(geos_search_locations))
5764
else:
5865
geos_include_dirs=[os.path.join(GEOS_dir,'include'),numpy.get_include()]
5966
geos_library_dirs=[os.path.join(GEOS_dir,'lib'),os.path.join(GEOS_dir,'lib64')]

0 commit comments

Comments
 (0)