Sun Feb 7 15:26:40 2010 UTC ()
Use a simpler patch from KDE's svn.


(wiz)
diff -r1.6 -r1.7 pkgsrc/x11/kdebindings4-python/distinfo
diff -r1.1 -r1.2 pkgsrc/x11/kdebindings4-python/patches/patch-ac

cvs diff -r1.6 -r1.7 pkgsrc/x11/kdebindings4-python/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/x11/kdebindings4-python/Attic/distinfo 2010/02/07 15:14:10 1.6
+++ pkgsrc/x11/kdebindings4-python/Attic/distinfo 2010/02/07 15:26:40 1.7
@@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
1$NetBSD: distinfo,v 1.6 2010/02/07 15:14:10 wiz Exp $ 1$NetBSD: distinfo,v 1.7 2010/02/07 15:26:40 wiz Exp $
2 2
3SHA1 (kdebindings-4.3.5.tar.bz2) = 0273013e4b74a7b1bc4cfc8375c80b5c19cf33e6 3SHA1 (kdebindings-4.3.5.tar.bz2) = 0273013e4b74a7b1bc4cfc8375c80b5c19cf33e6
4RMD160 (kdebindings-4.3.5.tar.bz2) = 96fd389226116717f1ab28e71c788a99a1a15981 4RMD160 (kdebindings-4.3.5.tar.bz2) = 96fd389226116717f1ab28e71c788a99a1a15981
5Size (kdebindings-4.3.5.tar.bz2) = 4881006 bytes 5Size (kdebindings-4.3.5.tar.bz2) = 4881006 bytes
6SHA1 (patch-aa) = f01b1d350a8e79e639f46c797baf035684275158 6SHA1 (patch-aa) = f01b1d350a8e79e639f46c797baf035684275158
7SHA1 (patch-ab) = cae51d216ad914009b4e9c80a17a172ec5a5eaec 7SHA1 (patch-ab) = cae51d216ad914009b4e9c80a17a172ec5a5eaec
8SHA1 (patch-ac) = a0fa3f5251b818cd6fc75396e2b22fc7c4abe23f 8SHA1 (patch-ac) = a01fdff457a9029a763c5eed9252c557994d637e

cvs diff -r1.1 -r1.2 pkgsrc/x11/kdebindings4-python/patches/Attic/patch-ac (expand / switch to unified diff)

--- pkgsrc/x11/kdebindings4-python/patches/Attic/patch-ac 2010/02/07 15:14:10 1.1
+++ pkgsrc/x11/kdebindings4-python/patches/Attic/patch-ac 2010/02/07 15:26:40 1.2
@@ -1,156 +1,20 @@ @@ -1,156 +1,20 @@
1$NetBSD: patch-ac,v 1.1 2010/02/07 15:14:10 wiz Exp $ 1$NetBSD: patch-ac,v 1.2 2010/02/07 15:26:40 wiz Exp $
 2
 3http://websvn.kde.org/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip?r1=1061966&r2=1064763&view=patch
2 4
3--- python/pykde4/sip/kdecore/typedefs.sip.orig 2009-10-02 08:21:29.000000000 +0000 5--- python/pykde4/sip/kdecore/typedefs.sip.orig 2009-10-02 08:21:29.000000000 +0000
4+++ python/pykde4/sip/kdecore/typedefs.sip 6+++ python/pykde4/sip/kdecore/typedefs.sip
5@@ -215,6 +215,122 @@ template <TYPE1,TYPE2*> 7@@ -466,91 +466,6 @@ template <TYPE1,TYPE2*>
6 %End 
7 }; 
8  
9+template <TYPE1,int> 
10+%MappedType QMap<TYPE1,int> 
11+{ 
12+%TypeHeaderCode 
13+#include <qmap.h> 
14+%End 
15+ 
16+%ConvertFromTypeCode 
17+ // Create the dictionary. 
18+ PyObject *d = PyDict_New(); 
19+ 
20+ if (!d) 
21+ return NULL; 
22+ 
23+ // Set the dictionary elements. 
24+ QMap<TYPE1, int>::const_iterator i = sipCpp->constBegin(); 
25+ 
26+ while (i != sipCpp->constEnd()) 
27+ { 
28+ TYPE1 *t1 = new TYPE1(i.key()); 
29+ int t2 = i.value(); 
30+ 
31+ PyObject *t1obj = sipConvertFromNewType(t1, sipType_TYPE1, sipTransferObj); 
32+#if PY_MAJOR_VERSION >= 3 
33+ PyObject *t2obj = PyLong_FromLong(t2); 
34+#else 
35+ PyObject *t2obj = PyInt_FromLong(t2); 
36+#endif 
37+ 
38+ if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0) 
39+ { 
40+ Py_DECREF(d); 
41+ 
42+ if (t1obj) { 
43+ Py_DECREF(t1obj); 
44+ } else { 
45+ delete t1; 
46+ }  
47+  
48+ if (t2obj) { 
49+ Py_DECREF(t2obj); 
50+ } 
51+ return NULL; 
52+ } 
53+ 
54+ Py_DECREF(t1obj); 
55+ Py_DECREF(t2obj); 
56+ 
57+ ++i; 
58+ } 
59+ 
60+ return d; 
61+%End 
62+ 
63+%ConvertToTypeCode 
64+ PyObject *t1obj; 
65+ PyObject *t2obj; 
66+ SIP_SSIZE_T i = 0; 
67+ 
68+ // Check the type if that is all that is required. 
69+ if (sipIsErr == NULL) 
70+ { 
71+ if (!PyDict_Check(sipPy)) 
72+ return 0; 
73+ 
74+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) 
75+ { 
76+ if (!sipCanConvertToType(t1obj, sipType_TYPE1, SIP_NOT_NONE)) 
77+ return 0; 
78+ 
79+#if PY_MAJOR_VERSION >= 3 
80+ if (!PyNumber_Check(t2obj)) 
81+#else 
82+ if (!PyInt_Check(t2obj)) 
83+#endif 
84+ return 0; 
85+ }  
86+ 
87+ return 1; 
88+ } 
89+ 
90+ QMap<TYPE1, int> *qm = new QMap<TYPE1, int>; 
91+  
92+ i = 0; 
93+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) 
94+ { 
95+ int state1; 
96+ 
97+ TYPE1 *t1 = reinterpret_cast<TYPE1 *>(sipConvertToType(t1obj, sipType_TYPE1, sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr)); 
98+ 
99+#if PY_MAJOR_VERSION >= 3 
100+ int t2 = PyLong_AsLong (t2obj); 
101+#else 
102+ int t2 = PyInt_AS_LONG (t2obj); 
103+#endif 
104+  
105+ if (*sipIsErr) 
106+ { 
107+ sipReleaseType(t1, sipType_TYPE1, state1); 
108+ 
109+ delete qm; 
110+ return 0; 
111+ } 
112+ 
113+ qm->insert(*t1, t2); 
114+ 
115+ sipReleaseType(t1, sipType_TYPE1, state1); 
116+ } 
117+  
118+ *sipCppPtr = qm; 
119+  
120+ return sipGetState(sipTransferObj); 
121+%End 
122+}; 
123+ 
124+ 
125 class KShared; 
126  
127 template <TYPE> 
128@@ -239,10 +355,10 @@ template <TYPE> 
129  
130 %ConvertToTypeCode 
131 // Convert a Python instance to a Ptr on the heap. 
132- 
133- if (sipIsErr == NULL) 
134- return PyInstance_Check(sipPy); 
135- 
136+ if (sipIsErr == NULL) { 
137+ return 1; 
138+ } 
139+  
140 int iserr = 0; 
141 TYPE *cpp = (TYPE *)sipForceConvertToType(sipPy, sipType_TYPE, NULL, 0, NULL, &iserr); 
142  
143@@ -466,91 +582,6 @@ template <TYPE1,TYPE2*> 
144 %End 8 %End
145 }; 9 };
146  10
147- 11-
148-template <TYPE*> 12-template <TYPE*>
149-%MappedType QSet<TYPE*> 13-%MappedType QSet<TYPE*>
150-{ 14-{
151-%TypeHeaderCode 15-%TypeHeaderCode
152-#include <qset.h> 16-#include <qset.h>
153-%End 17-%End
154- 18-
155-%ConvertFromTypeCode 19-%ConvertFromTypeCode
156- // Create the list. 20- // Create the list.
@@ -222,166 +86,13 @@ $NetBSD: patch-ac,v 1.1 2010/02/07 15:14 @@ -222,166 +86,13 @@ $NetBSD: patch-ac,v 1.1 2010/02/07 15:14
222- sipReleaseType(t, sipType_TYPE, state); 86- sipReleaseType(t, sipType_TYPE, state);
223- } 87- }
224-  88-
225- *sipCppPtr = qs; 89- *sipCppPtr = qs;
226-  90-
227- return sipGetState(sipTransferObj); 91- return sipGetState(sipTransferObj);
228-%End 92-%End
229-}; 93-};
230- 94-
231- 95-
232 template <TYPE> 96 template <TYPE>
233 %MappedType QSet<TYPE> 97 %MappedType QSet<TYPE>
234 { 98 {
235@@ -716,12 +747,14 @@ template <TYPE1,TYPE2> 
236 return NULL; 
237  
238 // Set the list elements. 
239- for (int i = 0; i < sipCpp->size(); ++i) 
240- { 
241+ for (int i = 0; i < sipCpp->size(); ++i) { 
242 PyObject *pobj; 
243  
244- if ((pobj = PyInt_FromLong(sipCpp->value(i))) == NULL) 
245- { 
246+#if PY_MAJOR_VERSION >= 3 
247+ if ((pobj = PyLong_FromLong(sipCpp->value(i))) == NULL) { 
248+#else 
249+ if ((pobj = PyInt_FromLong(sipCpp->value(i))) == NULL) { 
250+#endif 
251 Py_DECREF(l); 
252  
253 return NULL; 
254@@ -740,9 +773,14 @@ template <TYPE1,TYPE2> 
255  
256 QList<uint> *ql = new QList<uint>; 
257  
258- for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) 
259+ for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) { 
260+#if PY_MAJOR_VERSION >= 3 
261+ ql->append(PyLong_AsLong(PyList_GET_ITEM(sipPy, i))); 
262+#else 
263 ql->append(PyInt_AsLong(PyList_GET_ITEM(sipPy, i))); 
264-  
265+#endif  
266+ } 
267+  
268 *sipCppPtr = ql; 
269  
270 return sipGetState(sipTransferObj); 
271@@ -824,3 +862,116 @@ template <TYPE*> 
272 %End 
273 }; 
274  
275+%MappedType QHash<int,int> 
276+{ 
277+%TypeHeaderCode 
278+#include <qhash.h> 
279+%End 
280+ 
281+%ConvertFromTypeCode 
282+ // Create the dictionary. 
283+ PyObject *d = PyDict_New(); 
284+ 
285+ if (!d) 
286+ return NULL; 
287+ 
288+ // Set the dictionary elements. 
289+ QHash<int, int>::const_iterator i = sipCpp->constBegin(); 
290+ 
291+ while (i != sipCpp->constEnd()) 
292+ { 
293+ int t1 = i.key(); 
294+ int t2 = i.value(); 
295+ 
296+#if PY_MAJOR_VERSION >= 3 
297+ PyObject *t1obj = PyLong_FromLong ((long)t1); 
298+ PyObject *t2obj = PyLong_FromLong ((long)t2); 
299+#else 
300+ PyObject *t1obj = PyInt_FromLong ((long)t1); 
301+ PyObject *t2obj = PyInt_FromLong ((long)t2); 
302+#endif 
303+ 
304+ if (PyDict_SetItem(d, t1obj, t2obj) < 0) 
305+ { 
306+ Py_DECREF(d); 
307+ 
308+ if (t1obj) 
309+ Py_DECREF(t1obj); 
310+ 
311+ if (t2obj) 
312+ Py_DECREF(t2obj); 
313+ 
314+ return NULL; 
315+ } 
316+ 
317+ Py_DECREF(t1obj); 
318+ Py_DECREF(t2obj); 
319+ 
320+ ++i; 
321+ } 
322+ 
323+ return d; 
324+%End 
325+ 
326+%ConvertToTypeCode 
327+ PyObject *t1obj, *t2obj; 
328+ SIP_SSIZE_T i = 0; 
329+ 
330+ // Check the type if that is all that is required. 
331+ if (sipIsErr == NULL) 
332+ { 
333+ if (!PyDict_Check(sipPy)) 
334+ return 0; 
335+ 
336+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) 
337+ { 
338+#if PY_MAJOR_VERSION >= 3 
339+ if (!PyNumber_Check (t1obj)) 
340+#else 
341+ if (!PyInt_Check (t1obj)) 
342+#endif 
343+ return 0; 
344+ 
345+#if PY_MAJOR_VERSION >= 3 
346+ if (!PyNumber_Check (t2obj)) 
347+#else 
348+ if (!PyInt_Check (t2obj)) 
349+#endif 
350+ return 0; 
351+ }  
352+ 
353+ return 1; 
354+ } 
355+ 
356+ QHash<int, int> *qm = new QHash<int, int>; 
357+  
358+ while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) 
359+ { 
360+ int state2; 
361+ 
362+#if PY_MAJOR_VERSION >= 3 
363+ int t1 = PyLong_AsLong (t1obj); 
364+#else 
365+ int t1 = PyInt_AS_LONG (t1obj); 
366+#endif 
367+ 
368+#if PY_MAJOR_VERSION >= 3 
369+ int t2 = PyLong_AsLong (t2obj); 
370+#else 
371+ int t2 = PyInt_AS_LONG (t2obj); 
372+#endif 
373+  
374+ if (*sipIsErr) 
375+ { 
376+ delete qm; 
377+ return 0; 
378+ } 
379+ 
380+ qm->insert(t1, t2); 
381+ } 
382+  
383+ *sipCppPtr = qm; 
384+  
385+ return sipGetState(sipTransferObj); 
386+%End 
387+};