Sun Feb 7 15:14:10 2010 UTC ()
Make build with py-sip-4.10, and depend on it.
Patch from gentoo bug #301106 via drochner.
(wiz)
diff -r1.8 -r1.9 pkgsrc/x11/kdebindings4-python/Makefile
diff -r1.5 -r1.6 pkgsrc/x11/kdebindings4-python/distinfo
diff -r0 -r1.1 pkgsrc/x11/kdebindings4-python/patches/patch-ac
--- pkgsrc/x11/kdebindings4-python/Attic/Makefile 2010/01/27 10:38:41 1.8
+++ pkgsrc/x11/kdebindings4-python/Attic/Makefile 2010/02/07 15:14:10 1.9
| @@ -1,37 +1,42 @@ | | | @@ -1,37 +1,42 @@ |
1 | # $NetBSD: Makefile,v 1.8 2010/01/27 10:38:41 markd Exp $ | | 1 | # $NetBSD: Makefile,v 1.9 2010/02/07 15:14:10 wiz Exp $ |
2 | | | 2 | |
3 | PKGNAME= kdebindings4-python-${_KDE_VERSION} | | 3 | PKGNAME= kdebindings4-python-${_KDE_VERSION} |
| | | 4 | PKGREVISION= 1 |
4 | DISTNAME= kdebindings-${_KDE_VERSION} | | 5 | DISTNAME= kdebindings-${_KDE_VERSION} |
5 | CATEGORIES= misc | | 6 | CATEGORIES= misc |
6 | COMMENT= Python bindings for the KDE integrated X11 desktop | | 7 | COMMENT= Python bindings for the KDE integrated X11 desktop |
7 | | | 8 | |
8 | .include "../../meta-pkgs/kde4/Makefile.kde4" | | 9 | .include "../../meta-pkgs/kde4/Makefile.kde4" |
9 | | | 10 | |
10 | # BUILD_MAKE_FLAGS+= VERBOSE=1 | | 11 | # BUILD_MAKE_FLAGS+= VERBOSE=1 |
11 | | | 12 | |
12 | CMAKE_ARGS+= -DENABLE_SMOKE=off | | 13 | CMAKE_ARGS+= -DENABLE_SMOKE=off |
13 | CMAKE_ARGS+= -DENABLE_QYOTO=off | | 14 | CMAKE_ARGS+= -DENABLE_QYOTO=off |
14 | CMAKE_ARGS+= -DENABLE_QTRUBY=off -DENABLE_KORUNDUM=off | | 15 | CMAKE_ARGS+= -DENABLE_QTRUBY=off -DENABLE_KORUNDUM=off |
15 | CMAKE_ARGS+= -DENABLE_KROSSRUBY=off | | 16 | CMAKE_ARGS+= -DENABLE_KROSSRUBY=off |
16 | CMAKE_ARGS+= -DENABLE_KROSSJAVA=off -DENABLE_KROSSFALCON=off | | 17 | CMAKE_ARGS+= -DENABLE_KROSSJAVA=off -DENABLE_KROSSFALCON=off |
17 | CMAKE_ARGS+= -DPYTHON_EXECUTABLE:FILEPATH=${PYTHONBIN} | | 18 | CMAKE_ARGS+= -DPYTHON_EXECUTABLE:FILEPATH=${PYTHONBIN} |
18 | | | 19 | |
19 | PYTHON_VERSIONS_ACCEPTED= 26 25 | | 20 | PYTHON_VERSIONS_ACCEPTED= 26 25 |
20 | PY_PATCHPLIST= yes | | 21 | PY_PATCHPLIST= yes |
21 | PLIST_SUBST+= PYVERSSUFFIX=${PYVERSSUFFIX:Q} | | 22 | PLIST_SUBST+= PYVERSSUFFIX=${PYVERSSUFFIX:Q} |
22 | | | 23 | |
23 | post-extract: | | 24 | post-extract: |
24 | ${CP} ${FILESDIR}/FindPolkitQt.cmake ${WRKSRC}/cmake/modules | | 25 | ${CP} ${FILESDIR}/FindPolkitQt.cmake ${WRKSRC}/cmake/modules |
25 | | | 26 | |
| | | 27 | # for patch-ac: |
| | | 28 | post-install: |
| | | 29 | ${RM} ${DESTDIR}${PREFIX}/share/sip2.6/PyKDE4/kdecore/typedefs.sip.orig |
| | | 30 | |
26 | .include "../../meta-pkgs/kde4/kde4.mk" | | 31 | .include "../../meta-pkgs/kde4/kde4.mk" |
27 | | | 32 | |
28 | .include "../../lang/python/application.mk" | | 33 | .include "../../lang/python/application.mk" |
29 | .include "../../lang/python/extension.mk" | | 34 | .include "../../lang/python/extension.mk" |
30 | .include "../../misc/kdepimlibs4/buildlink3.mk" | | 35 | .include "../../misc/kdepimlibs4/buildlink3.mk" |
31 | .include "../../security/polkit-qt/buildlink3.mk" | | 36 | .include "../../security/polkit-qt/buildlink3.mk" |
32 | .include "../../x11/kdelibs4/buildlink3.mk" | | 37 | .include "../../x11/kdelibs4/buildlink3.mk" |
33 | BUILDLINK_API_DEPENDS.py-sip+= ${PYPKGPREFIX}-sip>=4.7.9 | | 38 | BUILDLINK_API_DEPENDS.py-sip+= ${PYPKGPREFIX}-sip>=4.10 |
34 | .include "../../x11/py-sip/buildlink3.mk" | | 39 | .include "../../x11/py-sip/buildlink3.mk" |
35 | .include "../../x11/py-qt4/buildlink3.mk" | | 40 | .include "../../x11/py-qt4/buildlink3.mk" |
36 | | | 41 | |
37 | .include "../../mk/bsd.pkg.mk" | | 42 | .include "../../mk/bsd.pkg.mk" |
--- pkgsrc/x11/kdebindings4-python/Attic/distinfo 2010/01/27 10:38:41 1.5
+++ pkgsrc/x11/kdebindings4-python/Attic/distinfo 2010/02/07 15:14:10 1.6
| @@ -1,7 +1,8 @@ | | | @@ -1,7 +1,8 @@ |
1 | $NetBSD: distinfo,v 1.5 2010/01/27 10:38:41 markd Exp $ | | 1 | $NetBSD: distinfo,v 1.6 2010/02/07 15:14:10 wiz Exp $ |
2 | | | 2 | |
3 | SHA1 (kdebindings-4.3.5.tar.bz2) = 0273013e4b74a7b1bc4cfc8375c80b5c19cf33e6 | | 3 | SHA1 (kdebindings-4.3.5.tar.bz2) = 0273013e4b74a7b1bc4cfc8375c80b5c19cf33e6 |
4 | RMD160 (kdebindings-4.3.5.tar.bz2) = 96fd389226116717f1ab28e71c788a99a1a15981 | | 4 | RMD160 (kdebindings-4.3.5.tar.bz2) = 96fd389226116717f1ab28e71c788a99a1a15981 |
5 | Size (kdebindings-4.3.5.tar.bz2) = 4881006 bytes | | 5 | Size (kdebindings-4.3.5.tar.bz2) = 4881006 bytes |
6 | SHA1 (patch-aa) = f01b1d350a8e79e639f46c797baf035684275158 | | 6 | SHA1 (patch-aa) = f01b1d350a8e79e639f46c797baf035684275158 |
7 | SHA1 (patch-ab) = cae51d216ad914009b4e9c80a17a172ec5a5eaec | | 7 | SHA1 (patch-ab) = cae51d216ad914009b4e9c80a17a172ec5a5eaec |
| | | 8 | SHA1 (patch-ac) = a0fa3f5251b818cd6fc75396e2b22fc7c4abe23f |
$NetBSD: patch-ac,v 1.1 2010/02/07 15:14:10 wiz Exp $
--- python/pykde4/sip/kdecore/typedefs.sip.orig 2009-10-02 08:21:29.000000000 +0000
+++ python/pykde4/sip/kdecore/typedefs.sip
@@ -215,6 +215,122 @@ template <TYPE1,TYPE2*>
%End
};
+template <TYPE1,int>
+%MappedType QMap<TYPE1,int>
+{
+%TypeHeaderCode
+#include <qmap.h>
+%End
+
+%ConvertFromTypeCode
+ // Create the dictionary.
+ PyObject *d = PyDict_New();
+
+ if (!d)
+ return NULL;
+
+ // Set the dictionary elements.
+ QMap<TYPE1, int>::const_iterator i = sipCpp->constBegin();
+
+ while (i != sipCpp->constEnd())
+ {
+ TYPE1 *t1 = new TYPE1(i.key());
+ int t2 = i.value();
+
+ PyObject *t1obj = sipConvertFromNewType(t1, sipType_TYPE1, sipTransferObj);
+#if PY_MAJOR_VERSION >= 3
+ PyObject *t2obj = PyLong_FromLong(t2);
+#else
+ PyObject *t2obj = PyInt_FromLong(t2);
+#endif
+
+ if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0)
+ {
+ Py_DECREF(d);
+
+ if (t1obj) {
+ Py_DECREF(t1obj);
+ } else {
+ delete t1;
+ }
+
+ if (t2obj) {
+ Py_DECREF(t2obj);
+ }
+ return NULL;
+ }
+
+ Py_DECREF(t1obj);
+ Py_DECREF(t2obj);
+
+ ++i;
+ }
+
+ return d;
+%End
+
+%ConvertToTypeCode
+ PyObject *t1obj;
+ PyObject *t2obj;
+ SIP_SSIZE_T i = 0;
+
+ // Check the type if that is all that is required.
+ if (sipIsErr == NULL)
+ {
+ if (!PyDict_Check(sipPy))
+ return 0;
+
+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
+ {
+ if (!sipCanConvertToType(t1obj, sipType_TYPE1, SIP_NOT_NONE))
+ return 0;
+
+#if PY_MAJOR_VERSION >= 3
+ if (!PyNumber_Check(t2obj))
+#else
+ if (!PyInt_Check(t2obj))
+#endif
+ return 0;
+ }
+
+ return 1;
+ }
+
+ QMap<TYPE1, int> *qm = new QMap<TYPE1, int>;
+
+ i = 0;
+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
+ {
+ int state1;
+
+ TYPE1 *t1 = reinterpret_cast<TYPE1 *>(sipConvertToType(t1obj, sipType_TYPE1, sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr));
+
+#if PY_MAJOR_VERSION >= 3
+ int t2 = PyLong_AsLong (t2obj);
+#else
+ int t2 = PyInt_AS_LONG (t2obj);
+#endif
+
+ if (*sipIsErr)
+ {
+ sipReleaseType(t1, sipType_TYPE1, state1);
+
+ delete qm;
+ return 0;
+ }
+
+ qm->insert(*t1, t2);
+
+ sipReleaseType(t1, sipType_TYPE1, state1);
+ }
+
+ *sipCppPtr = qm;
+
+ return sipGetState(sipTransferObj);
+%End
+};
+
+
class KShared;
template <TYPE>
@@ -239,10 +355,10 @@ template <TYPE>
%ConvertToTypeCode
// Convert a Python instance to a Ptr on the heap.
-
- if (sipIsErr == NULL)
- return PyInstance_Check(sipPy);
-
+ if (sipIsErr == NULL) {
+ return 1;
+ }
+
int iserr = 0;
TYPE *cpp = (TYPE *)sipForceConvertToType(sipPy, sipType_TYPE, NULL, 0, NULL, &iserr);
@@ -466,91 +582,6 @@ template <TYPE1,TYPE2*>
%End
};
-
-template <TYPE*>
-%MappedType QSet<TYPE*>
-{
-%TypeHeaderCode
-#include <qset.h>
-%End
-
-%ConvertFromTypeCode
- // Create the list.
- PyObject *l;
-
- if ((l = PyList_New(sipCpp->size())) == NULL)
- return NULL;
-
- // Set the list elements.
- QSet<TYPE*> set = *sipCpp;
- int i = 0;
- foreach ((TYPE *)value, set)
- {
- PyObject *obj = sipConvertFromNewType(value, sipType_TYPE, sipTransferObj);
- if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)
- {
- Py_DECREF(l);
-
- if (obj)
- Py_DECREF(obj);
-
- return NULL;
- }
-
- Py_DECREF(obj);
- i++;
- }
-
- return l;
-%End
-
-%ConvertToTypeCode
- // Check the type if that is all that is required.
- if (sipIsErr == NULL)
- {
- if (!PyList_Check(sipPy))
- return 0;
- }
-
- // 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 (!sipCanConvertToType(PyList_GET_ITEM (sipPy, i), sipType_TYPE, SIP_NOT_NONE))
- return 0;
- }
-
- QSet<TYPE*> *qs = new QSet<TYPE*>;
-
- for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
- {
- int state;
-
- TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM (l, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
-
- if (*sipIsErr)
- {
- sipReleaseType(t, sipType_TYPE, state);
-
- delete qs;
- return 0;
- }
-
- *qs << t;
-
- sipReleaseType(t, sipType_TYPE, state);
- }
-
- *sipCppPtr = qs;
-
- return sipGetState(sipTransferObj);
-%End
-};
-
-
template <TYPE>
%MappedType QSet<TYPE>
{
@@ -716,12 +747,14 @@ template <TYPE1,TYPE2>
return NULL;
// Set the list elements.
- for (int i = 0; i < sipCpp->size(); ++i)
- {
+ for (int i = 0; i < sipCpp->size(); ++i) {
PyObject *pobj;
- if ((pobj = PyInt_FromLong(sipCpp->value(i))) == NULL)
- {
+#if PY_MAJOR_VERSION >= 3
+ if ((pobj = PyLong_FromLong(sipCpp->value(i))) == NULL) {
+#else
+ if ((pobj = PyInt_FromLong(sipCpp->value(i))) == NULL) {
+#endif
Py_DECREF(l);
return NULL;
@@ -740,9 +773,14 @@ template <TYPE1,TYPE2>
QList<uint> *ql = new QList<uint>;
- for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
+ for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) {
+#if PY_MAJOR_VERSION >= 3
+ ql->append(PyLong_AsLong(PyList_GET_ITEM(sipPy, i)));
+#else
ql->append(PyInt_AsLong(PyList_GET_ITEM(sipPy, i)));
-
+#endif
+ }
+
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
@@ -824,3 +862,116 @@ template <TYPE*>
%End
};
+%MappedType QHash<int,int>
+{
+%TypeHeaderCode
+#include <qhash.h>
+%End
+
+%ConvertFromTypeCode
+ // Create the dictionary.
+ PyObject *d = PyDict_New();
+
+ if (!d)
+ return NULL;
+
+ // Set the dictionary elements.
+ QHash<int, int>::const_iterator i = sipCpp->constBegin();
+
+ while (i != sipCpp->constEnd())
+ {
+ int t1 = i.key();
+ int t2 = i.value();
+
+#if PY_MAJOR_VERSION >= 3
+ PyObject *t1obj = PyLong_FromLong ((long)t1);
+ PyObject *t2obj = PyLong_FromLong ((long)t2);
+#else
+ PyObject *t1obj = PyInt_FromLong ((long)t1);
+ PyObject *t2obj = PyInt_FromLong ((long)t2);
+#endif
+
+ if (PyDict_SetItem(d, t1obj, t2obj) < 0)
+ {
+ Py_DECREF(d);
+
+ if (t1obj)
+ Py_DECREF(t1obj);
+
+ if (t2obj)
+ Py_DECREF(t2obj);
+
+ return NULL;
+ }
+
+ Py_DECREF(t1obj);
+ Py_DECREF(t2obj);
+
+ ++i;
+ }
+
+ return d;
+%End
+
+%ConvertToTypeCode
+ PyObject *t1obj, *t2obj;
+ SIP_SSIZE_T i = 0;
+
+ // Check the type if that is all that is required.
+ if (sipIsErr == NULL)
+ {
+ if (!PyDict_Check(sipPy))
+ return 0;
+
+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
+ {
+#if PY_MAJOR_VERSION >= 3
+ if (!PyNumber_Check (t1obj))
+#else
+ if (!PyInt_Check (t1obj))
+#endif
+ return 0;
+
+#if PY_MAJOR_VERSION >= 3
+ if (!PyNumber_Check (t2obj))
+#else
+ if (!PyInt_Check (t2obj))
+#endif
+ return 0;
+ }
+
+ return 1;
+ }
+
+ QHash<int, int> *qm = new QHash<int, int>;
+
+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
+ {
+ int state2;
+
+#if PY_MAJOR_VERSION >= 3
+ int t1 = PyLong_AsLong (t1obj);
+#else
+ int t1 = PyInt_AS_LONG (t1obj);
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ int t2 = PyLong_AsLong (t2obj);
+#else
+ int t2 = PyInt_AS_LONG (t2obj);
+#endif
+
+ if (*sipIsErr)
+ {
+ delete qm;
+ return 0;
+ }
+
+ qm->insert(t1, t2);
+ }
+
+ *sipCppPtr = qm;
+
+ return sipGetState(sipTransferObj);
+%End
+};