[Community] Shapely, ctypes and finding geos_c
Sean Gillies
sgillies at frii.com
Fri Feb 8 17:29:15 EET 2008
Christopher Barker wrote:
> Sean Gillies wrote:
>> Christopher Barker wrote:
>>> if lib is None:
>>> ## try a few more locations
>>> ## This, or course, could be a lot smarter!
>>> lib_paths =
>>> ["/Library/Frameworks/GEOS.framework/Versions/Current/unix/lib/libgeos_c.dylib",#
>>> The Framework build from Kyng Chaos:
>>> ]
>>> for path in lib_paths:
>>> if os.path.exists(path):
>>> lib = path
>>> break
>>> else:
>>> raise Exception("Could not find geos_c library")
>
>> The only problem I see with the patch is that the framework name/path
>> looks arbitrary to me. But then I don't know much about the Mac lib
>> frameworks.
>
> Well, it's not entirely arbitrary -- Frameworks all go in either:
>
> /Library/Frameworks/ (for user-installed stuff)
> or
> /System/Frameworks/ (for Apple-installed stuff)
>
> within the Framework, the "Version/Current is standard. however, the
> name GEOS.Framework may not be -- it's hard to be too standard if the
> Framework isn't provided by apple, or part of the official build of the
> lib -- I don't know if William has contributed his Framework building
> code to the geos project.
>
> There is also this complications -- the "Apple-y" way to do it is to
> have the actual shared lib in:
>
> GEOS.framework/Versions/Current.GEOS (no extension)
>
> The "unix/lib/libgeos_c.dylib" part is William's trick for making the
> Framework look like a more traditional unix setup so other libs that
> don't understand frameworks can build against it. As I look, I see that
> unix/lib/libgeos_c.dylib is actually a link back to "GEOS" anyway, so
> the patch should be:
>
> elif sys.platform == 'darwin':
> lib = find_library('geos_c')
> if lib is None:
> ## try a few more locations
> ## This, or course, could be a lot smarter!
> lib_paths =
> ["/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",# The
> Framework build from Kyng Chaos:
> ]
> for path in lib_paths:
> if os.path.exists(path):
> lib = path
> break
> else:
> raise Exception("Could not find geos_c library")
> lgeos = CDLL(lib)
> free = CDLL(find_library('libc')).free
> else:
>
> That's about as "standard" as it will ever get. And William's stuff is
> getting pretty wide use. The other open question is if we want to point
> to "Current" or specifacally to 3.0 (which is the same on my system, but
> may not be in the future.)
>
> As I mentioned, there is also macports and fink, that put these things
> it yet another place. The idea behind what I've done is that others can
> contribute their paths, and eventually, we may find most of them
> automagically.
>
> This is ugly, but I don't know how else to do it. They call it dll hell
> for a reason!
>
> -Chris
I'm coordinating with Mr. geo-fink, Kurt Schwehr, right now. It seems to
do the normal GNU thing, much like you'd get with a configure; make;
make install.
I made a new ticket for the above
http://trac.gispython.org/projects/PCL/ticket/154
and patched it in r1048. Feel like giving it a test drive?
svn co http://svn.gispython.org/svn/gispy/Shapely/trunk Shapely
With no other bug to address right now, that is poised to become Shapely
1.0.1. Thanks for the patch,
Sean
More information about the Community
mailing list