@@ -37,27 +37,33 @@ def get_geos_install_prefix():
3737 candidates = [os .path .expanduser ("~/local" ), os .path .expanduser ("~" ),
3838 "/usr/local" , "/usr" , "/opt/local" , "/opt" , "/sw" ]
3939
40+ # Prepare filename pattern to find the GEOS library.
41+ extensions = {"win32" : "dll" , "cygwin" : "dll" , "darwin" : "dylib" }
42+ libext = extensions .get (sys .platform , "so*" )
43+ libname = "*geos_c*.{0}" .format (libext )
44+ libdirs = ["bin" , "lib" , "lib/x86_64-linux-gnu" , "lib64" ]
45+
4046 for prefix in candidates :
4147 libfiles = []
42- libdirs = ["bin" , "lib" , "lib/x86_64-linux-gnu" , "lib64" ]
43- libext = "dll" if os .name == "nt" else "so"
44- libcode = "{0}geos_c" .format ("" if os .name == "nt" else "lib" )
45- libname = "{0}*.{1}*" .format (libcode , libext )
4648 for libdir in libdirs :
4749 libfiles .extend (glob .glob (os .path .join (prefix , libdir , libname )))
4850 hfile = os .path .join (prefix , "include" , "geos_c.h" )
4951 if os .path .isfile (hfile ) and libfiles :
5052 return prefix
5153
52- warnings .warn (" " .join ([
53- "Cannot find GEOS library and/or headers in standard locations" ,
54- "('{0}'). Please install the corresponding packages using your" ,
55- "software management system or set the environment variable" ,
56- "GEOS_DIR to point to the location where GEOS is installed" ,
57- "(for example, if 'geos_c.h' is in '/usr/local/include'" ,
58- "and 'libgeos_c' is in '/usr/local/lib', then you need to" ,
59- "set GEOS_DIR to '/usr/local'" ,
60- ]).format ("', '" .join (candidates )), RuntimeWarning )
54+ # At this point, the GEOS library was not found, so we throw a warning if
55+ # the user is trying to build the library.
56+ build_cmds = ("bdist_wheel" , "build" , "install" )
57+ if any (cmd in sys .argv [1 :] for cmd in build_cmds ):
58+ warnings .warn (" " .join ([
59+ "Cannot find GEOS library and/or headers in standard locations" ,
60+ "('{0}'). Please install the corresponding packages using your" ,
61+ "software management system or set the environment variable" ,
62+ "GEOS_DIR to point to the location where GEOS is installed" ,
63+ "(for example, if 'geos_c.h' is in '/usr/local/include'" ,
64+ "and 'libgeos_c' is in '/usr/local/lib', then you need to" ,
65+ "set GEOS_DIR to '/usr/local'" ,
66+ ]).format ("', '" .join (candidates )), RuntimeWarning )
6167 return None
6268
6369
@@ -94,7 +100,9 @@ def run(self):
94100 import numpy
95101 include_dirs .append (numpy .get_include ())
96102 except ImportError as err :
97- warnings .warn ("unable to locate NumPy headers" , RuntimeWarning )
103+ build_cmds = ("bdist_wheel" , "build" , "install" )
104+ if any (cmd in sys .argv [1 :] for cmd in build_cmds ):
105+ warnings .warn ("unable to locate NumPy headers" , RuntimeWarning )
98106
99107# Define GEOS include, library and runtime dirs.
100108geos_install_prefix = get_geos_install_prefix ()
@@ -164,7 +172,7 @@ def run(self):
164172 "name" :
165173 "basemap" ,
166174 "version" :
167- "1.3.2 " ,
175+ "1.3.3 " ,
168176 "license" :
169177 "MIT" ,
170178 "description" :
0 commit comments