portable spatialite import, issue 774, thanks TheBigBamboozle and Denes
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.7 (2012-05-04 10:27:00) dev
|
Version 1.99.7 (2012-05-04 10:47:21) dev
|
||||||
|
|||||||
+9
-2
@@ -134,6 +134,11 @@ DEFAULTLENGTH = {'string':512,
|
|||||||
'text':2**15,
|
'text':2**15,
|
||||||
'blob':2**31}
|
'blob':2**31}
|
||||||
TIMINGSSIZE = 100
|
TIMINGSSIZE = 100
|
||||||
|
SPATIALLIBS = {
|
||||||
|
'Windows':'libspatialite',
|
||||||
|
'Linux':'libspatialite.so',
|
||||||
|
'Darwin':'libspatialite.dylib'
|
||||||
|
}
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@@ -161,6 +166,7 @@ import hashlib
|
|||||||
import uuid
|
import uuid
|
||||||
import glob
|
import glob
|
||||||
import traceback
|
import traceback
|
||||||
|
import platform
|
||||||
|
|
||||||
CALLABLETYPES = (types.LambdaType, types.FunctionType, types.BuiltinFunctionType,
|
CALLABLETYPES = (types.LambdaType, types.FunctionType, types.BuiltinFunctionType,
|
||||||
types.MethodType, types.BuiltinMethodType)
|
types.MethodType, types.BuiltinMethodType)
|
||||||
@@ -1875,8 +1881,9 @@ class SpatiaLiteAdapter(SQLiteAdapter):
|
|||||||
self.connection.enable_load_extension(True)
|
self.connection.enable_load_extension(True)
|
||||||
# for Windows, rename libspatialite-2.dll as libspatialite.dll
|
# for Windows, rename libspatialite-2.dll as libspatialite.dll
|
||||||
# Linux uses libspatialite.so
|
# Linux uses libspatialite.so
|
||||||
# Mac OS X uses libspatialite.dylib
|
# Mac OS X uses libspatialite.dylib
|
||||||
self.execute(r'SELECT load_extension("libspatialite");')
|
libspatialite = SPATIALLIBS[platform.system()]
|
||||||
|
self.execute(r'SELECT load_extension("%s");') % libspatialite
|
||||||
|
|
||||||
self.connection.create_function('web2py_extract', 2,
|
self.connection.create_function('web2py_extract', 2,
|
||||||
SQLiteAdapter.web2py_extract)
|
SQLiteAdapter.web2py_extract)
|
||||||
|
|||||||
Reference in New Issue
Block a user