[pyspatialite] 04/05: Add patch to support spatialite_init_ex() as alternative for the deprecated spatialite_init() method.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri May 29 17:03:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository pyspatialite.

commit a63285cabe7fc11d5e459a17e4352f00811127cd
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri May 29 17:22:58 2015 +0200

    Add patch to support spatialite_init_ex() as alternative for the deprecated spatialite_init() method.
---
 debian/changelog                           |  2 +
 debian/patches/01-spatialite_init_ex.patch | 85 ++++++++++++++++++++++++++++++
 debian/patches/series                      |  1 +
 3 files changed, 88 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ff4d7dd..d45b19d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ pyspatialite (3.0.1-7) UNRELEASED; urgency=medium
   * Update my email to @debian.org address.
   * Update Vcs-Browser URL to use cgit instead of gitweb.
   * Bump Standards-Version to 3.9.6, no changes.
+  * Add patch to support spatialite_init_ex() as alternative for the
+    deprecated spatialite_init() method.
 
  -- Bas Couwenberg <sebastic at debian.org>  Wed, 29 Apr 2015 21:59:47 +0200
 
diff --git a/debian/patches/01-spatialite_init_ex.patch b/debian/patches/01-spatialite_init_ex.patch
new file mode 100644
index 0000000..0dc8db4
--- /dev/null
+++ b/debian/patches/01-spatialite_init_ex.patch
@@ -0,0 +1,85 @@
+Description: Support 'new' spatialite_init_ex() scheme as alternative for the deprecated spatialite_init() method.
+Author: Jürgen E. Fischer <jef at norbit.de>
+Origin: https://github.com/qgis/QGIS/commit/d7ca190295079957a8d0ef446cd834351020e901
+Bug: https://github.com/lokkju/pyspatialite/issues/24
+
+--- a/setup.py
++++ b/setup.py
+@@ -130,6 +130,7 @@ class MyBuildExt(build_ext):
+         ext.define_macros.append(("SQLITE_ENABLE_RTREE", "1"))   # build with fulltext search enabled
+         ext.define_macros.append(("SQLITE_ENABLE_COLUMN_METADATA", "1"))   # build with fulltext search enabled
+         ext.define_macros.append(("OMIT_FREEXL","1")) # build without FreeXL
++        ext.define_macros.append(("SPATIALITE_HAS_INIT_EX","1")) # don't use deprecated spatialite_init() method
+         #ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c"))
+         #ext.sources.append(os.path.join(AMALGAMATION_ROOT, "spatialite.c"))
+         #ext.include_dirs.append(AMALGAMATION_ROOT)
+--- a/src/connection.c
++++ b/src/connection.c
+@@ -29,6 +29,7 @@
+ #include "prepare_protocol.h"
+ #include "util.h"
+ #include "sqlitecompat.h"
++#include "spatialite.h"
+ 
+ #include "pythread.h"
+ 
+@@ -81,7 +82,6 @@ int pysqlite_connection_init(pysqlite_Co
+     }
+ 
+     self->initialized = 1;
+-    spatialite_init(0);
+     self->begin_statement = NULL;
+ 
+     self->statement_cache = NULL;
+@@ -106,7 +106,15 @@ int pysqlite_connection_init(pysqlite_Co
+         }
+ 
+         Py_BEGIN_ALLOW_THREADS
++#if defined(SPATIALITE_HAS_INIT_EX)
++        self->slconn = spatialite_alloc_connection();
++#else
++        spatialite_init( 0 );
++#endif
+         rc = sqlite3_open(PyString_AsString(database_utf8), &self->db);
++#if defined(SPATIALITE_HAS_INIT_EX)
++        spatialite_init_ex( self->db, self->slconn, 0 );
++#endif
+         Py_END_ALLOW_THREADS
+ 
+         Py_DECREF(database_utf8);
+@@ -272,6 +280,9 @@ void pysqlite_connection_dealloc(pysqlit
+     if (self->db) {
+         Py_BEGIN_ALLOW_THREADS
+         sqlite3_close(self->db);
++#if defined(SPATIALITE_HAS_INIT_EX)
++        spatialite_cleanup_ex( self->slconn );
++#endif
+         Py_END_ALLOW_THREADS
+     } else if (self->apsw_connection) {
+         ret = PyObject_CallMethod(self->apsw_connection, "close", "");
+@@ -372,6 +383,9 @@ PyObject* pysqlite_connection_close(pysq
+         } else {
+             Py_BEGIN_ALLOW_THREADS
+             rc = sqlite3_close(self->db);
++#if defined(SPATIALITE_HAS_INIT_EX)
++            spatialite_cleanup_ex( self->slconn );
++#endif
+             Py_END_ALLOW_THREADS
+ 
+             if (rc != SQLITE_OK) {
+--- a/src/connection.h
++++ b/src/connection.h
+@@ -33,12 +33,11 @@
+ #include "sqlite3.h"
+ #include "spatialite.h"
+ 
+-int spatialite_init(int verbose);
+-
+ typedef struct
+ {
+     PyObject_HEAD
+     sqlite3* db;
++    void *slconn;
+ 
+     /* 1 if we are currently within a transaction, i. e. if a BEGIN has been
+      * issued */
diff --git a/debian/patches/series b/debian/patches/series
index b75ec23..d6750a5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 00-fix_build.patch
+01-spatialite_init_ex.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pyspatialite.git



More information about the Pkg-grass-devel mailing list