|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
py2exe to package a distributable executableHi 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 tartley@... +44 7737 062 225 twitter/skype: tartley _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
Re: py2exe to package a distributable executableHi 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 > tartley@... +44 7737 062 225 twitter/skype: tartley > > > _______________________________________________ > Community mailing list > Community@... > http://lists.gispython.org/mailman/listinfo/community -- Sean _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
Re: py2exe to package a distributable executableFair 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 >> tartley@... +44 7737 062 225 twitter/skype: tartley >> >> >> _______________________________________________ >> Community mailing list >> Community@... >> http://lists.gispython.org/mailman/listinfo/community >> > > -- > Sean > > _______________________________________________ > Community mailing list > Community@... > http://lists.gispython.org/mailman/listinfo/community > > -- Jonathan Hartley Made of meat. http://tartley.com tartley@... +44 7737 062 225 twitter/skype: tartley _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
Re: py2exe to package a distributable executableI 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 >>> tartley@... +44 7737 062 225 twitter/skype: tartley >>> >>> >>> _______________________________________________ >>> Community mailing list >>> Community@... >>> http://lists.gispython.org/mailman/listinfo/community >>> >> >> -- >> Sean >> >> _______________________________________________ >> Community mailing list >> Community@... >> http://lists.gispython.org/mailman/listinfo/community >> >> > Jonathan Hartley Made of meat. http://tartley.com tartley@... +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 Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
Re: py2exe to package a distributable executableOh, and the alternative hackaround I wondered about - manually trying to
include ctypes_declarations.py in the output of py2exe, but outside of library.zip - does not work. Obviously Shapely is looking for this file in a particular location, and the path it is looking at is inside the zipfile. Trying to open a file with this path fails as you might expect. Jonathan Hartley wrote: > 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 >>>> tartley@... +44 7737 062 225 twitter/skype: tartley >>>> >>>> >>>> _______________________________________________ >>>> Community mailing list >>>> Community@... >>>> http://lists.gispython.org/mailman/listinfo/community >>>> >>> >>> -- >>> Sean >>> >>> _______________________________________________ >>> Community mailing list >>> Community@... >>> http://lists.gispython.org/mailman/listinfo/community >>> >>> >> > -- Jonathan Hartley Made of meat. http://tartley.com tartley@... +44 7737 062 225 twitter/skype: tartley _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
Re: py2exe to package a distributable executableJonathan,
This looks good, and I'm looking forward to testing it. Can I ask you to try a different diff format? "diff -ruB" would be ideal for me. And please attach it to a ticket at http://trac.gispython.org/lab/newticket after registering on the wiki. Tests: if you get the Shapely-1.0 branch source like svn co http://svn.gispython.org/svn/gispy/Shapely/branches/1.0 Shapely-1.0 and copy the GEOS DLLs to Shapely-1.0/DLLs, you should able to run tests from that location: $ python setup.py test Cheers, On Aug 26, 2009, at 4:12 PM, Jonathan Hartley wrote: > 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 >>>> tartley@... +44 7737 062 225 twitter/skype: tartley >>>> >>>> >>>> _______________________________________________ >>>> Community mailing list >>>> Community@... >>>> http://lists.gispython.org/mailman/listinfo/community >>>> >>> >>> -- >>> Sean >>> >>> _______________________________________________ >>> Community mailing list >>> Community@... >>> http://lists.gispython.org/mailman/listinfo/community >>> >>> >> > > -- > Jonathan Hartley Made of meat. http://tartley.com > tartley@... +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 > Community@... > http://lists.gispython.org/mailman/listinfo/community -- Sean _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
|
|
|
Re: py2exe to package a distributable executableHi Jonathan,
I applied the patch, tested, and committed in r1416. See http://trac.gispython.org/lab/ticket/189 I'll start to prepare a milestone 1.0.13 milestone and engage developers in wider testing. Thanks! On Aug 28, 2009, at 1:33 AM, jonathan hartley wrote: > Hey there Sean et al, > > There's a new ticket here: > http://trac.gispython.org/lab/ticket/189 > I forgot to use wiki markup on the traceback, sorreeee. > > I get a couple of test failures on a pristine working copy > (attached.) One of them at least looks like a known issue with > locales. I'm running Python2.6 on WinXP with mostly UK oriented > settings. It's midnight here and I just got home, but I'll look at > these fails again on Saturday, try 'em on Linux too, see if I can > understand what's up. > > Anyhow, I made the same source code changes as in the patch I > previously mailed to the list. The test results are unaffected by > this change. The patch is now attached to the ticket. I used the > unified diff as produced by 'svn diff', I hope that's appropriate. > > Many thanks for guiding me through this, it's much appreciated. > > Best, > > Jonathan > > > Sean Gillies wrote: >> Jonathan, >> >> This looks good, and I'm looking forward to testing it. Can I ask >> you to try a different diff format? >> >> "diff -ruB" >> >> would be ideal for me. And please attach it to a ticket at >> >> http://trac.gispython.org/lab/newticket >> >> after registering on the wiki. >> >> Tests: if you get the Shapely-1.0 branch source like >> >> svn co http://svn.gispython.org/svn/gispy/Shapely/branches/1.0 >> Shapely-1.0 >> >> and copy the GEOS DLLs to Shapely-1.0/DLLs, you should able to run >> tests from that location: >> >> $ python setup.py test >> >> Cheers, >> >> On Aug 26, 2009, at 4:12 PM, Jonathan Hartley wrote: >> >> >>> 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 >>>>>> tartley@... +44 7737 062 225 twitter/skype: tartley >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Community mailing list >>>>>> Community@... >>>>>> http://lists.gispython.org/mailman/listinfo/community >>>>>> >>>>>> >>>>> -- >>>>> Sean >>>>> >>>>> _______________________________________________ >>>>> Community mailing list >>>>> Community@... >>>>> http://lists.gispython.org/mailman/listinfo/community >>>>> >>>>> >>>>> >>> -- >>> Jonathan Hartley Made of meat. http://tartley.com >>> tartley@... +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 >>> Community@... >>> http://lists.gispython.org/mailman/listinfo/community >>> >> >> -- >> Sean >> >> _______________________________________________ >> Community mailing list >> Community@... >> http://lists.gispython.org/mailman/listinfo/community >> >> > > -- > Jonathan Hartley Made of meat. http://tartley.com > tartley@... +44 7737 062 225 twitter/skype: tartley > > >> python setup.py test > running test > running egg_info > writing requirements to Shapely.egg-info\requires.txt > writing Shapely.egg-info\PKG-INFO > writing top-level names to Shapely.egg-info\top_level.txt > writing dependency_links to Shapely.egg-info\dependency_links.txt > unrecognized .svn/entries format in > reading manifest file 'Shapely.egg-info\SOURCES.txt' > writing manifest file 'Shapely.egg-info\SOURCES.txt' > running build_ext > c:\documents and settings\jhartley\my dropbox\projects\shapely-patch > \shapely-1.0\tests\test_doctests.pyc > Doctest: Array.txt ... ok > Doctest: attribute-chains.txt ... bufferOriginalPrecision failed > (TopologyException: assigned depths do not match 0.366203 > -0.536501), trying with reduced precision > recomputing with precision scale factor = 1e+11 > Scaler: offsetX,Y: 0,0 scaleFactor: 1e+11 > ReScaler: offsetX,Y: 0,0 scaleFactor: 1e+11 > FAIL > Doctest: binascii_hex.txt ... ok > Doctest: dimensions.txt ... ok > Doctest: GeoInterface.txt ... ok > Doctest: invalid_intersection.txt ... ok > Doctest: IterOps.txt ... ok > Doctest: LineString.txt ... ok > Doctest: MultiLineString.txt ... ok > Doctest: MultiPoint.txt ... ok > Doctest: MultiPolygon.txt ... ok > Doctest: Operations.txt ... ok > Doctest: Persist.txt ... ok > Doctest: Point.txt ... ok > Doctest: Polygon.txt ... ok > Doctest: polygonize.txt ... ok > Doctest: Predicates.txt ... ok > Doctest: wkt_locale.txt ... FAIL > > ====================================================================== > FAIL: Doctest: attribute-chains.txt > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "C:\Python25\lib\doctest.py", line 2128, in runTest > raise self.failureException(self.format_failure(new.getvalue())) > AssertionError: Failed doctest test for attribute-chains.txt > File "c:\documents and settings\jhartley\my dropbox\projects > \shapely-patch\shapely-1.0\tests\attribute-chains.txt", line 0 > > ---------------------------------------------------------------------- > File "c:\documents and settings\jhartley\my dropbox\projects\shapely- > patch\shapely-1.0\tests\attribute-chains.txt", line 12, in attribute- > chains.txt > Failed example: > print list(Point(0.0, 0.0).buffer(1.0).exterior.coords) > Expected: > [(0.0, -1.0), (-1.0, -1.0), ... > Got: > [(1.0, 0.0), (0.99518472667219693, -0.098017140329560506), > (0.98078528040323054, -0.19509032201612808), (0.95694033573220894, > -0.29028467725446211), (0.92387953251128696, -0.38268343236508939), > (0.88192126434835527, -0.4713967368259972), (0.83146961230254557, > -0.55557023301960173), (0.77301045336273744, -0.63439328416364493), > (0.70710678118654813, -0.70710678118654691), (0.63439328416364626, > -0.77301045336273633), (0.55557023301960307, -0.83146961230254468), > (0.47139673682599859, -0.88192126434835449), (0.38268343236509084, > -0.92387953251128629), (0.29028467725446361, -0.95694033573220849), > (0.19509032201612964, -0.98078528040323021), (0.098017140329562089, > -0.99518472667219671), (1.615542552166338e-015, -1.0), > (-0.098017140329558883, -0.99518472667219704), > (-0.19509032201612647, -0.98078528040323076), (-0.2902846772544605, > -0.95694033573220938), (-0.38268343236508784, -0.92387953251128752), > (-0.4713967368259957, -0.88192126434835605), (-0.55557023301960051, > -0.83146961230254635), (-0.63439328416364393, -0.77301045336273821), > (-0.70710678118654624, -0.70710678118654879), (-0.77301045336273588, > -0.63439328416364682), (-0.83146961230254435, -0.55557023301960362), > (-0.88192126434835427, -0.47139673682599903), (-0.92387953251128618, > -0.38268343236509111), (-0.95694033573220849, -0.29028467725446366), > (-0.98078528040323021, -0.19509032201612947), (-0.99518472667219682, > -0.098017140329561714), (-1.0, -1.010639055082363e-015), > (-0.99518472667219693, 0.098017140329559702), (-0.98078528040323065, > 0.1950903220161275), (-0.95694033573220905, 0.29028467725446172), > (-0.92387953251128696, 0.38268343236508923), (-0.88192126434835527, > 0.47139673682599725), (-0.83146961230254546, 0.55557023301960196), > (-0.7730104533627371, 0.63439328416364527), (-0.70710678118654768, > 0.70710678118654746), (-0.63439328416364593, 0.77301045336273666), > (-0.55557023301960295, 0.83146961230254479), (-0.4713967368259987, > 0.88192126434835449), (-0.38268343236509117, 0.92387953251128618), > (-0.29028467725446411, 0.95694033573220838), (-0.19509032201613041, > 0.98078528040322999), (-0.098017140329563102, 0.9951847266721966), > (-2.8482262121737323e-015, 1.0), (0.098017140329557426, > 0.99518472667219715), (0.19509032201612481, 0.9807852804032311), > (0.29028467725445867, 0.95694033573220993), (0.3826834323650859, > 0.9238795325112884), (0.47139673682599365, 0.88192126434835716), > (0.55557023301959818, 0.8314696123025479), (0.63439328416364149, > 0.77301045336274021), (0.70710678118654358, 0.70710678118655146), > (0.77301045336273322, 0.63439328416365004), (0.83146961230254179, > 0.5555702330196074), (0.88192126434835194, 0.47139673682600342), > (0.92387953251128407, 0.38268343236509617), (0.95694033573220671, > 0.29028467725446927), (0.98078528040322899, 0.19509032201613569), > (0.99518472667219615, 0.098017140329568472), (1.0, > 8.2385270480656025e-015), (1.0, 0.0)] > > > ====================================================================== > FAIL: Doctest: wkt_locale.txt > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "C:\Python25\lib\doctest.py", line 2128, in runTest > raise self.failureException(self.format_failure(new.getvalue())) > AssertionError: Failed doctest test for wkt_locale.txt > File "c:\documents and settings\jhartley\my dropbox\projects > \shapely-patch\shapely-1.0\tests\wkt_locale.txt", line 0 > > ---------------------------------------------------------------------- > File "c:\documents and settings\jhartley\my dropbox\projects\shapely- > patch\shapely-1.0\tests\wkt_locale.txt", line 7, in wkt_locale.txt > Failed example: > locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8') > Exception raised: > Traceback (most recent call last): > File "C:\Python25\lib\doctest.py", line 1228, in __run > compileflags, 1) in test.globs > File "<doctest wkt_locale.txt[1]>", line 1, in <module> > locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8') > File "C:\Python25\lib\locale.py", line 478, in setlocale > return _setlocale(category, locale) > Error: unsupported locale setting > > > ---------------------------------------------------------------------- > Ran 18 tests in 0.328s > > FAILED (failures=2) > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'GEOSGeom_destroy'" in <bound method Point.__del__ of > <shapely.geometry.point.Point object at 0x00F455B0>> ignored > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'GEOSGeom_destroy'" in <bound method MultiPolygon.__del__ > of <shapely.geometry.multipolygon.MultiPolygon object at > 0x00F17870>> ignored > > > > _______________________________________________ > Community mailing list > Community@... > http://lists.gispython.org/mailman/listinfo/community -- Sean _______________________________________________ Community mailing list Community@... http://lists.gispython.org/mailman/listinfo/community |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |