I don't really know what I'm doing here, but I have a patch that fixes my problem (attached.) I'm groping my way through this, so presumably I need to do a bunch of other things before this is actually done.

I don't know whether the Shapely source code repositories are public. Or should I be using the PyPI 'setup.py develop' to get the source and tests? For now, I'm working on the source download I got from http://pypi.python.org/pypi/Shapely

The source changes I made in the attached patch are:
Instead of geos.py running ctypes_declarations.py using execfile, it now calls a function defined in that module, passing the lgeos object upon which attributes should be defined. I don't pretend to understand why it used execfile in the first place, so I may have made an atrocious mistake here.

This change makes py2exe work happily with Shapely, using only the 'data_files' entry in setup.py that I described earlier. My program still appears to execute correctly on Windows XP. This is the only testing I have done. Does Shapely have tests suites somewhere that I could run?

I created the patch using:
   diff -crB Shapely-1.0.12 Shapely-1.0.12-new > no_more_execfile.patch
Is there a more appropriate way I should have done this?

Thanks for any guidance,

   Jonathan


Jonathan Hartley wrote:
Fair enough. I don't know how Shapely works - so I can only vaguely infer what you mean. However, with that caveat I'll take a look at the code and get back to the list when I understand enough to have questions.

It crosses my mind that if you are doing what I think you're doing (ie. manually reading the contents of ctypes_declarations.py and eval'ing it) then a hackaround solution might be for me to copy ctypes_declarations.py into my py2exe output without putting it into library.zip. I'll try that out too.

Thanks,

   Jonathan

Sean Gillies wrote:
Hi Jonathan,

I've no experience with py2exe, but I'm not surprised that the declarations are causing you problems. A better way might be to write a function, that when passed _lgeos, does the prototyping. We'd then call that function instead of eval'ing ctypes_declarations.py. Is a working patch along these lines something you might be interested in contributing? If so, I'd be happy to push for a Shapely 1.0.13 release.

Cheers,
Sean

On Aug 26, 2009, at 12:35 PM, Jonathan Hartley wrote:

Hi all,

I'm trying to package my Python program up into an executable using
py2exe, so that users can run the exe without having to install (or know
anything about) Python.

I'm stumbling over shapely\ctypes_declarations.py, which just isn't
included in the py2exe distribution, causing a runtime error when I
execute my .exe:

IOError: [Errno 2] No such file or directory: 'C:\\Documents and
Settings\\jhartley\\My
Dropbox\\projects\\solescion\\dist\\SoleScion-win-binary-0.2.6-svn\ \exe\\library.zip\\shapely\\ctypes_declarations.py'
Traceback (most recent call last):
 File "main.py", line 5, in <module>
 File "solescion\controller\application.pyo", line 6, in <module>
 File "solescion\controller\gameloop.pyo", line 10, in <module>
 File "solescion\controller\graphics.pyo", line 5, in <module>
 File "solescion\geom\svgload\svg_parser.pyo", line 4, in <module>
 File "shapely\geometry\__init__.pyo", line 1, in <module>
 File "shapely\geometry\geo.pyo", line 5, in <module>
 File "shapely\geometry\point.pyo", line 10, in <module>
 File "shapely\geos.pyo", line 56, in <module>
IOError: [Errno 2] No such file or directory: 'C:\\Documents and
Settings\\jhartley\\My
Dropbox\\projects\\solescion\\dist\\SoleScion-win-binary-0.2.6-svn\ \exe\\library.zip\\shapely\\ctypes_declarations.py'

I tried manually copying /ctypes_declaration.py/ from Shapely directory
into py2exe's library.zip, but I still get the same error on running,
much to my puzzlement. Presumably I could tweak my /setup.py/ to include
ctypes_declaration.py automatically, (and I will try this) but I don't
see how that will help if the manual copy has had no effect.

Am I doing it very wrong? Does anyone have a recipe or working example
of using Shapely with py2exe?

Sorry if this is covered somewhere, I've been Googling but to no avail.

Shapely is installed in a virtualenv (which is active) and the
libgeos.dll is included in the py2exe executable by adding the following
to my setup.py:

       data_files = [
           ('', ['solescion/lib/geos.dll']),
           ('', ['solescion/lib/libgeos-3-0-0.dll']),
       ],

Thanks for any pointers,

   Jonathan

--
Jonathan Hartley      Made of meat.      http://tartley.com
[email protected]   +44 7737 062 225   twitter/skype: tartley


_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

--
Sean

_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community



--
Jonathan Hartley      Made of meat.      http://tartley.com
[email protected]   +44 7737 062 225   twitter/skype: tartley


diff -crB Shapely-1.0.12/shapely/ctypes_declarations.py 
Shapely-1.0.12-new/shapely/ctypes_declarations.py
*** Shapely-1.0.12/shapely/ctypes_declarations.py       Thu Apr  9 21:18:43 2009
--- Shapely-1.0.12-new/shapely/ctypes_declarations.py   Wed Aug 26 14:50:39 2009
***************
*** 1,204 ****
  import ctypes
  
! lgeos = lgeos   # reduce pyflakes complaints
  
! lgeos.initGEOS.restype = None
  
! lgeos.finishGEOS.restype = None
  
! lgeos.GEOSversion.restype = ctypes.c_char_p
  
! lgeos.GEOSGeomFromWKT.restype = ctypes.c_void_p
! lgeos.GEOSGeomFromWKT.argtypes = [ctypes.c_char_p]
  
! lgeos.GEOSGeomToWKT.restype = ctypes.c_char_p
! lgeos.GEOSGeomToWKT.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOS_setWKBOutputDims.restype = ctypes.c_int
! lgeos.GEOS_setWKBOutputDims.argtypes = [ctypes.c_int]
  
! lgeos.GEOSGeomFromWKB_buf.restype = ctypes.c_void_p
! lgeos.GEOSGeomFromWKB_buf.argtypes = [ctypes.c_void_p, ctypes.c_size_t]
  
! lgeos.GEOSCoordSeq_create.restype = ctypes.c_void_p
! lgeos.GEOSCoordSeq_create.argtypes = [ctypes.c_uint, ctypes.c_uint]
  
! lgeos.GEOSCoordSeq_clone.restype = ctypes.c_void_p
! lgeos.GEOSCoordSeq_clone.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_destroy.restype = None
! lgeos.GEOSCoordSeq_destroy.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_setX.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_setX.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
! lgeos.GEOSCoordSeq_setY.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_setY.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
! lgeos.GEOSCoordSeq_setZ.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_setZ.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
! lgeos.GEOSCoordSeq_setOrdinate.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_setOrdinate.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_uint, ctypes.c_double]
  
! lgeos.GEOSCoordSeq_getX.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_getX.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_getY.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_getY.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_getZ.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_getZ.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_getSize.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_getSize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSCoordSeq_getDimensions.restype = ctypes.c_int
! lgeos.GEOSCoordSeq_getDimensions.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSGeom_createPoint.restype = ctypes.c_void_p
! lgeos.GEOSGeom_createPoint.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_createLinearRing.restype = ctypes.c_void_p
! lgeos.GEOSGeom_createLinearRing.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_createLineString.restype = ctypes.c_void_p
! lgeos.GEOSGeom_createLineString.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_createPolygon.restype = ctypes.c_void_p
! lgeos.GEOSGeom_createPolygon.argtypes = [ctypes.c_void_p, ctypes.c_void_p, 
ctypes.c_uint]
  
! lgeos.GEOSGeom_createCollection.restype = ctypes.c_void_p
! lgeos.GEOSGeom_createCollection.argtypes = [ctypes.c_int, ctypes.c_void_p, 
ctypes.c_uint]
  
! lgeos.GEOSGeom_clone.restype = ctypes.c_void_p
! lgeos.GEOSGeom_clone.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_destroy.restype = None
! lgeos.GEOSGeom_destroy.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSEnvelope.restype = ctypes.c_void_p
! lgeos.GEOSEnvelope.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSIntersection.restype = ctypes.c_void_p
! lgeos.GEOSIntersection.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSBuffer.restype = ctypes.c_void_p
! lgeos.GEOSBuffer.argtypes = [ctypes.c_void_p, ctypes.c_double, ctypes.c_int]
  
! lgeos.GEOSConvexHull.restype = ctypes.c_void_p
! lgeos.GEOSConvexHull.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSDifference.restype = ctypes.c_void_p
! lgeos.GEOSDifference.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSSymDifference.restype = ctypes.c_void_p
! lgeos.GEOSSymDifference.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSBoundary.restype = ctypes.c_void_p
! lgeos.GEOSBoundary.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSUnion.restype = ctypes.c_void_p
! lgeos.GEOSUnion.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSPointOnSurface.restype = ctypes.c_void_p
! lgeos.GEOSPointOnSurface.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGetCentroid.restype = ctypes.c_void_p
! lgeos.GEOSGetCentroid.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSRelate.restype = ctypes.c_char_p
! lgeos.GEOSRelate.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSPolygonize.restype = ctypes.c_void_p
! lgeos.GEOSPolygonize.argtypes = [ctypes.c_void_p, ctypes.c_uint]
  
! lgeos.GEOSLineMerge.restype = ctypes.c_void_p
! lgeos.GEOSLineMerge.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSRelatePattern.restype = ctypes.c_char
! lgeos.GEOSRelatePattern.argtypes = [ctypes.c_void_p, ctypes.c_void_p, 
ctypes.c_char_p]
  
! lgeos.GEOSDisjoint.restype = ctypes.c_int
! lgeos.GEOSDisjoint.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSTouches.restype = ctypes.c_int
! lgeos.GEOSTouches.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSIntersects.restype = ctypes.c_int
! lgeos.GEOSIntersects.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSCrosses.restype = ctypes.c_int
! lgeos.GEOSCrosses.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSWithin.restype = ctypes.c_int
! lgeos.GEOSWithin.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSContains.restype = ctypes.c_int
! lgeos.GEOSContains.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSOverlaps.restype = ctypes.c_int
! lgeos.GEOSOverlaps.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSEquals.restype = ctypes.c_int
! lgeos.GEOSEquals.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSisEmpty.restype = ctypes.c_int
! lgeos.GEOSisEmpty.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSisValid.restype = ctypes.c_int
! lgeos.GEOSisValid.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSisSimple.restype = ctypes.c_int
! lgeos.GEOSisSimple.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSisRing.restype = ctypes.c_int
! lgeos.GEOSisRing.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSHasZ.restype = ctypes.c_int
! lgeos.GEOSHasZ.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeomType.restype = ctypes.c_char_p
! lgeos.GEOSGeomType.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeomTypeId.restype = ctypes.c_int
! lgeos.GEOSGeomTypeId.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGetSRID.restype = ctypes.c_int
! lgeos.GEOSGetSRID.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSSetSRID.restype = None
! lgeos.GEOSSetSRID.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
! lgeos.GEOSGetNumGeometries.restype = ctypes.c_int
! lgeos.GEOSGetNumGeometries.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGetGeometryN.restype = ctypes.c_void_p
! lgeos.GEOSGetGeometryN.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
! lgeos.GEOSGetNumInteriorRings.restype = ctypes.c_int
! lgeos.GEOSGetNumInteriorRings.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGetInteriorRingN.restype = ctypes.c_void_p
! lgeos.GEOSGetInteriorRingN.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
! lgeos.GEOSGetExteriorRing.restype = ctypes.c_void_p
! lgeos.GEOSGetExteriorRing.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGetNumCoordinates.restype = ctypes.c_int
! lgeos.GEOSGetNumCoordinates.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_getCoordSeq.restype = ctypes.c_void_p
! lgeos.GEOSGeom_getCoordSeq.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSGeom_getDimensions.restype = ctypes.c_int
! lgeos.GEOSGeom_getDimensions.argtypes = [ctypes.c_void_p]
  
! lgeos.GEOSArea.restype = ctypes.c_double
! lgeos.GEOSArea.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
! lgeos.GEOSLength.restype = ctypes.c_int
! lgeos.GEOSLength.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
! 
! lgeos.GEOSDistance.restype = ctypes.c_int
! lgeos.GEOSDistance.argtypes = [ctypes.c_void_p, ctypes.c_void_p, 
ctypes.c_void_p]
--- 1,203 ----
  import ctypes
  
! def prototype(lgeos):
!     lgeos.initGEOS.restype = None
  
!     lgeos.finishGEOS.restype = None
  
!     lgeos.GEOSversion.restype = ctypes.c_char_p
  
!     lgeos.GEOSGeomFromWKT.restype = ctypes.c_void_p
!     lgeos.GEOSGeomFromWKT.argtypes = [ctypes.c_char_p]
  
!     lgeos.GEOSGeomToWKT.restype = ctypes.c_char_p
!     lgeos.GEOSGeomToWKT.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOS_setWKBOutputDims.restype = ctypes.c_int
!     lgeos.GEOS_setWKBOutputDims.argtypes = [ctypes.c_int]
  
!     lgeos.GEOSGeomFromWKB_buf.restype = ctypes.c_void_p
!     lgeos.GEOSGeomFromWKB_buf.argtypes = [ctypes.c_void_p, ctypes.c_size_t]
  
!     lgeos.GEOSCoordSeq_create.restype = ctypes.c_void_p
!     lgeos.GEOSCoordSeq_create.argtypes = [ctypes.c_uint, ctypes.c_uint]
  
!     lgeos.GEOSCoordSeq_clone.restype = ctypes.c_void_p
!     lgeos.GEOSCoordSeq_clone.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_destroy.restype = None
!     lgeos.GEOSCoordSeq_destroy.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_setX.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_setX.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
!     lgeos.GEOSCoordSeq_setY.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_setY.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
!     lgeos.GEOSCoordSeq_setZ.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_setZ.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_double]
  
!     lgeos.GEOSCoordSeq_setOrdinate.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_setOrdinate.argtypes = [ctypes.c_void_p, 
ctypes.c_uint, ctypes.c_uint, ctypes.c_double]
  
!     lgeos.GEOSCoordSeq_getX.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_getX.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_getY.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_getY.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_getZ.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_getZ.argtypes = [ctypes.c_void_p, ctypes.c_uint, 
ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_getSize.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_getSize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSCoordSeq_getDimensions.restype = ctypes.c_int
!     lgeos.GEOSCoordSeq_getDimensions.argtypes = [ctypes.c_void_p, 
ctypes.c_void_p]
  
!     lgeos.GEOSGeom_createPoint.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_createPoint.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_createLinearRing.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_createLinearRing.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_createLineString.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_createLineString.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_createPolygon.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_createPolygon.argtypes = [ctypes.c_void_p, 
ctypes.c_void_p, ctypes.c_uint]
  
!     lgeos.GEOSGeom_createCollection.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_createCollection.argtypes = [ctypes.c_int, 
ctypes.c_void_p, ctypes.c_uint]
  
!     lgeos.GEOSGeom_clone.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_clone.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_destroy.restype = None
!     lgeos.GEOSGeom_destroy.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSEnvelope.restype = ctypes.c_void_p
!     lgeos.GEOSEnvelope.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSIntersection.restype = ctypes.c_void_p
!     lgeos.GEOSIntersection.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSBuffer.restype = ctypes.c_void_p
!     lgeos.GEOSBuffer.argtypes = [ctypes.c_void_p, ctypes.c_double, 
ctypes.c_int]
  
!     lgeos.GEOSConvexHull.restype = ctypes.c_void_p
!     lgeos.GEOSConvexHull.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSDifference.restype = ctypes.c_void_p
!     lgeos.GEOSDifference.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSSymDifference.restype = ctypes.c_void_p
!     lgeos.GEOSSymDifference.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSBoundary.restype = ctypes.c_void_p
!     lgeos.GEOSBoundary.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSUnion.restype = ctypes.c_void_p
!     lgeos.GEOSUnion.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSPointOnSurface.restype = ctypes.c_void_p
!     lgeos.GEOSPointOnSurface.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGetCentroid.restype = ctypes.c_void_p
!     lgeos.GEOSGetCentroid.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSRelate.restype = ctypes.c_char_p
!     lgeos.GEOSRelate.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSPolygonize.restype = ctypes.c_void_p
!     lgeos.GEOSPolygonize.argtypes = [ctypes.c_void_p, ctypes.c_uint]
  
!     lgeos.GEOSLineMerge.restype = ctypes.c_void_p
!     lgeos.GEOSLineMerge.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSRelatePattern.restype = ctypes.c_char
!     lgeos.GEOSRelatePattern.argtypes = [ctypes.c_void_p, ctypes.c_void_p, 
ctypes.c_char_p]
  
!     lgeos.GEOSDisjoint.restype = ctypes.c_int
!     lgeos.GEOSDisjoint.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSTouches.restype = ctypes.c_int
!     lgeos.GEOSTouches.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSIntersects.restype = ctypes.c_int
!     lgeos.GEOSIntersects.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSCrosses.restype = ctypes.c_int
!     lgeos.GEOSCrosses.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSWithin.restype = ctypes.c_int
!     lgeos.GEOSWithin.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSContains.restype = ctypes.c_int
!     lgeos.GEOSContains.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSOverlaps.restype = ctypes.c_int
!     lgeos.GEOSOverlaps.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSEquals.restype = ctypes.c_int
!     lgeos.GEOSEquals.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSisEmpty.restype = ctypes.c_int
!     lgeos.GEOSisEmpty.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSisValid.restype = ctypes.c_int
!     lgeos.GEOSisValid.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSisSimple.restype = ctypes.c_int
!     lgeos.GEOSisSimple.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSisRing.restype = ctypes.c_int
!     lgeos.GEOSisRing.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSHasZ.restype = ctypes.c_int
!     lgeos.GEOSHasZ.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeomType.restype = ctypes.c_char_p
!     lgeos.GEOSGeomType.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeomTypeId.restype = ctypes.c_int
!     lgeos.GEOSGeomTypeId.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGetSRID.restype = ctypes.c_int
!     lgeos.GEOSGetSRID.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSSetSRID.restype = None
!     lgeos.GEOSSetSRID.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
!     lgeos.GEOSGetNumGeometries.restype = ctypes.c_int
!     lgeos.GEOSGetNumGeometries.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGetGeometryN.restype = ctypes.c_void_p
!     lgeos.GEOSGetGeometryN.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
!     lgeos.GEOSGetNumInteriorRings.restype = ctypes.c_int
!     lgeos.GEOSGetNumInteriorRings.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGetInteriorRingN.restype = ctypes.c_void_p
!     lgeos.GEOSGetInteriorRingN.argtypes = [ctypes.c_void_p, ctypes.c_int]
  
!     lgeos.GEOSGetExteriorRing.restype = ctypes.c_void_p
!     lgeos.GEOSGetExteriorRing.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGetNumCoordinates.restype = ctypes.c_int
!     lgeos.GEOSGetNumCoordinates.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_getCoordSeq.restype = ctypes.c_void_p
!     lgeos.GEOSGeom_getCoordSeq.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSGeom_getDimensions.restype = ctypes.c_int
!     lgeos.GEOSGeom_getDimensions.argtypes = [ctypes.c_void_p]
  
!     lgeos.GEOSArea.restype = ctypes.c_double
!     lgeos.GEOSArea.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSLength.restype = ctypes.c_int
!     lgeos.GEOSLength.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
  
!     lgeos.GEOSDistance.restype = ctypes.c_int
!     lgeos.GEOSDistance.argtypes = [ctypes.c_void_p, ctypes.c_void_p, 
ctypes.c_void_p]
diff -crB Shapely-1.0.12/shapely/geos.py Shapely-1.0.12-new/shapely/geos.py
*** Shapely-1.0.12/shapely/geos.py      Thu Apr  9 21:18:43 2009
--- Shapely-1.0.12-new/shapely/geos.py  Wed Aug 26 14:53:44 2009
***************
*** 8,13 ****
--- 8,15 ----
  from ctypes import cdll, CDLL, PyDLL, CFUNCTYPE, c_char_p
  from ctypes.util import find_library
  
+ from ctypes_declarations import prototype
+ 
  if sys.platform == 'win32':
      try:
          local_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
***************
*** 52,59 ****
  
  
  # Load the ctypes restype and argtype declarations for geos_c functions.
! _here = os.path.abspath(os.path.dirname(__file__))
! execfile(os.path.join(_here, 'ctypes_declarations.py'))
  
  class allocated_c_char_p(c_char_p):
      pass
--- 54,60 ----
  
  
  # Load the ctypes restype and argtype declarations for geos_c functions.
! prototype(lgeos)
  
  class allocated_c_char_p(c_char_p):
      pass
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to