From c30caa95b9d132483ca70765fb97309c9fed2599bc140c809d2b7cd294f7e63b Mon Sep 17 00:00:00 2001 From: Otto Dassau Date: Mon, 30 Nov 2009 16:29:31 +0000 Subject: [PATCH] added pytch to support sip >= 4.9 OBS-URL: https://build.opensuse.org/package/show/Application:Geo/qgis?expand=0&rev=99 --- qgis.spec | 7 +- sip49_support.patch | 202 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 sip49_support.patch diff --git a/qgis.spec b/qgis.spec index d153ae9..9868293 100644 --- a/qgis.spec +++ b/qgis.spec @@ -6,7 +6,8 @@ Group: Applications/GIS Source: %{name}-%{version}.tar.bz2 Source1: %{name}.desktop Source2: %{name}.rpmlintrc -#Patch: sqlite3.patch +#Patch0: sqlite3.patch +Patch1: sip49_support.patch Url: http://www.qgis.org/ Summary: Quantum GIS (QGIS) is a Geographic Information System (GIS) Packager: Otto Dassau @@ -75,7 +76,8 @@ GRASS plugin for Quantum GIS development branch 1.x required to interface with G %prep %setup -#%patch -p1 +#%patch0 -p1 +%patch1 -p1 %build export CFLAGS="$RPM_OPT_FLAGS" @@ -159,6 +161,7 @@ rm -rf %{buildroot} %changelog -n qgis * Mon Nov 30 2009 Otto Dassau 1.3 +- added patch for sip >= 4.9 support - added python-qt4-devel requirement for opensuse 11.2 and factory * Sun Sep 13 2009 Otto Dassau 1.3 - changes and updates for new qgis development version diff --git a/sip49_support.patch b/sip49_support.patch new file mode 100644 index 0000000..bbf4b1b --- /dev/null +++ b/sip49_support.patch @@ -0,0 +1,202 @@ +--- qgis-1.3.0/python/core/conversions.sip 2009-05-14 17:58:24.000000000 +0200 ++++ qgis_head/python/core/conversions.sip 2009-11-30 15:07:42.000000000 +0100 +@@ -3,6 +3,7 @@ + which are not wrapped by PyQt: + - QVector< QVector > + - QVector< QVector< QVector > > ++- QList< QList > + - QSet + - QSet + - QMap > +@@ -19,6 +20,7 @@ + #if (PY_VERSION_HEX < 0x02050000) + typedef int Py_ssize_t; + #endif ++ + %End + + +@@ -28,6 +30,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -104,6 +110,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -175,10 +185,93 @@ + }; + + ++ ++template ++%MappedType QList< QList > ++{ ++%TypeHeaderCode ++#include ++%End ++ ++%ConvertFromTypeCode ++ // Create the list. ++ PyObject *l; ++ ++ if ((l = PyList_New(sipCpp->size())) == NULL) ++ return NULL; ++ ++ const sipMappedType* qlist_type = sipFindMappedType("QList"); ++ ++ // Set the list elements. ++ for (int i = 0; i < sipCpp->size(); ++i) ++ { ++ QList* t = new QList(sipCpp->at(i)); ++ PyObject *tobj; ++ ++ if ((tobj = sipConvertFromMappedType(t, qlist_type, sipTransferObj)) == NULL) ++ { ++ Py_DECREF(l); ++ delete t; ++ return NULL; ++ } ++ PyList_SET_ITEM(l, i, tobj); ++ } ++ ++ return l; ++%End ++ ++%ConvertToTypeCode ++ const sipMappedType* qlist_type = sipFindMappedType("QList"); ++ ++ // Check the type if that is all that is required. ++ if (sipIsErr == NULL) ++ { ++ if (!PyList_Check(sipPy)) ++ return 0; ++ ++ for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) ++ if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, SIP_NOT_NONE)) ++ return 0; ++ ++ return 1; ++ } ++ ++ ++ QList< QList > *ql = new QList< QList >; ++ ++ for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) ++ { ++ int state; ++ //TYPE *t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); ++ QList * t = reinterpret_cast< QList * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); ++ ++ if (*sipIsErr) ++ { ++ sipReleaseInstance(t, sipClass_TYPE, state); ++ delete ql; ++ return 0; ++ } ++ ql->append(*t); ++ sipReleaseInstance(t, sipClass_TYPE, state); ++ } ++ ++ *sipCppPtr = ql; ++ return sipGetState(sipTransferObj); ++%End ++ ++}; ++ ++ ++ ++ + %MappedType QSet + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -229,6 +322,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -301,6 +398,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -418,6 +519,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -518,7 +623,11 @@ + %MappedType QMap + { + %TypeHeaderCode +-#include ++#include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -626,6 +735,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode +@@ -744,6 +857,10 @@ + { + %TypeHeaderCode + #include ++#if (SIP_VERSION >= 0x040900) ++#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString)) ++#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant)) ++#endif + %End + + %ConvertFromTypeCode