diff options
author | Carsten Lohrke <carlo@gentoo.org> | 2006-10-22 15:10:32 +0000 |
---|---|---|
committer | Carsten Lohrke <carlo@gentoo.org> | 2006-10-22 15:10:32 +0000 |
commit | bee03af616b5d86151a8eb3bb89fe7a1401e57c9 (patch) | |
tree | 9274b5d6609bd27404a37c54e23525422e941eaa | |
parent | didn't get committed? (diff) | |
download | gentoo-2-bee03af616b5d86151a8eb3bb89fe7a1401e57c9.tar.gz gentoo-2-bee03af616b5d86151a8eb3bb89fe7a1401e57c9.tar.bz2 gentoo-2-bee03af616b5d86151a8eb3bb89fe7a1401e57c9.zip |
Python 2.5 compatibility.
(Portage version: 2.1.2_pre3-r6)
-rw-r--r-- | dev-python/sip/ChangeLog | 8 | ||||
-rw-r--r-- | dev-python/sip/files/digest-sip-4.2.1-r1 | 3 | ||||
-rw-r--r-- | dev-python/sip/files/sip-4.2.1-python-2.5-compat.diff | 356 | ||||
-rw-r--r-- | dev-python/sip/sip-4.2.1-r1.ebuild | 52 |
4 files changed, 418 insertions, 1 deletions
diff --git a/dev-python/sip/ChangeLog b/dev-python/sip/ChangeLog index 5ad9c7ebbef0..e4bfd8a2c35d 100644 --- a/dev-python/sip/ChangeLog +++ b/dev-python/sip/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-python/sip # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/sip/ChangeLog,v 1.81 2006/06/11 10:27:02 carlo Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/sip/ChangeLog,v 1.82 2006/10/22 15:10:32 carlo Exp $ + +*sip-4.2.1-r1 (22 Oct 2006) + + 22 Oct 2006; Carsten Lohrke <carlo@gentoo.org> + +files/sip-4.2.1-python-2.5-compat.diff, +sip-4.2.1-r1.ebuild: + Python 2.5 compatibility. *sip-4.4.5 (11 Jun 2006) diff --git a/dev-python/sip/files/digest-sip-4.2.1-r1 b/dev-python/sip/files/digest-sip-4.2.1-r1 new file mode 100644 index 000000000000..3262025aae04 --- /dev/null +++ b/dev-python/sip/files/digest-sip-4.2.1-r1 @@ -0,0 +1,3 @@ +MD5 552d8487ab419320b2bdb50f45d256ca sip-4.2.1.tar.gz 313308 +RMD160 f65e3adcfbd3e2030051aba5a7c96daad39a8599 sip-4.2.1.tar.gz 313308 +SHA256 6197d6d0d2111ceb25c1de0ca6a0addb4395d0320f2046c636e53d17ea6de0c5 sip-4.2.1.tar.gz 313308 diff --git a/dev-python/sip/files/sip-4.2.1-python-2.5-compat.diff b/dev-python/sip/files/sip-4.2.1-python-2.5-compat.diff new file mode 100644 index 000000000000..7067a7f0701f --- /dev/null +++ b/dev-python/sip/files/sip-4.2.1-python-2.5-compat.diff @@ -0,0 +1,356 @@ +--- sipgen/gencode.c 2005/08/25 21:02:16 453320 ++++ sipgen/gencode.c 2006/10/11 22:54:45 594670 +@@ -3043,13 +3043,17 @@ + + if (isNumberSlot(md) || isInplaceNumberSlot(md)) + prcode(fp, ++"#if PY_VERSION_HEX >= 0x02050000\n" ++" if (!PyType_IsSubtype(sipSelf -> ob_type,&sipClass_%C -> super.ht_type))\n" ++"#else\n" + " if (!PyType_IsSubtype(sipSelf -> ob_type,&sipClass_%C -> super.type))\n" ++"#endif\n" + " {\n" + " Py_INCREF(Py_NotImplemented);\n" + " return Py_NotImplemented;\n" + " }\n" + "\n" +- ,classFQCName(cd)); ++ ,classFQCName(cd),classFQCName(cd)); + + prcode(fp, + " %S *sipCpp = reinterpret_cast<%S *>(sipGetCppPtr((sipWrapper *)sipSelf,sipClass_%C));\n" +--- siplib/objmap.c 2005/08/25 21:02:16 453320 ++++ siplib/objmap.c 2006/09/28 06:39:22 589485 +@@ -114,8 +114,13 @@ + * of it, or vice versa, then we assume it is the same C++ + * object. + */ ++#if PY_VERSION_HEX >= 0x02050000 ++ if (PyObject_TypeCheck(w,&type -> super.ht_type) || ++ PyType_IsSubtype(&type -> super.ht_type,w -> ob_type)) ++#else + if (PyObject_TypeCheck(w,&type -> super.type) || + PyType_IsSubtype(&type -> super.type,w -> ob_type)) ++#endif + return w; + } + +--- siplib/qtlib.cpp 2005/08/25 21:02:16 453320 ++++ siplib/qtlib.cpp 2006/09/28 06:39:22 589485 +@@ -1232,7 +1232,7 @@ + // specified the slot at "obj, SLOT('meth()')" + // rather than "obj.meth" (see below). + +- char *meth; ++ const char *meth; + + // Get the method name. + meth = ((PyCFunctionObject *)rxObj) -> m_ml -> ml_name; +--- siplib/sip.h 2005/08/25 21:02:16 453320 ++++ siplib/sip.h 2006/10/11 14:34:14 594517 +@@ -47,6 +47,12 @@ + #define SIP_VERSION_STR "4.2.1" + #define SIP_BUILD "297" + ++/* Some internal compatibility stuff. */ ++#if PY_VERSION_HEX >= 0x02050000 ++#define _SIP_SSIZE_T Py_ssize_t ++#else ++#define _SIP_SSIZE_T int ++#endif + + /* + * Define the current API version number. SIP must handle modules with the +@@ -535,12 +541,12 @@ + * The following are part of the public API. + */ + void (*api_bad_catcher_result)(PyObject *method); +- void (*api_bad_length_for_slice)(int seqlen,int slicelen); ++ void (*api_bad_length_for_slice)(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen); + PyObject *(*api_build_result)(int *isErr,char *fmt,...); + PyObject *(*api_call_method)(int *isErr,PyObject *method,char *fmt,...); + PyObject *(*api_class_name)(PyObject *self); + PyObject *(*api_connect_rx)(PyObject *txObj,const char *sig,PyObject *rxObj,const char *slot); +- int (*api_convert_from_sequence_index)(int idx,int len); ++ _SIP_SSIZE_T (*api_convert_from_sequence_index)(_SIP_SSIZE_T idx,_SIP_SSIZE_T len); + void *(*api_convert_to_cpp)(PyObject *sipSelf,sipWrapperType *type,int *iserrp); + PyObject *(*api_disconnect_rx)(PyObject *txObj,const char *sig,PyObject *rxObj,const char *slot); + int (*api_emit_signal)(PyObject *self,const char *sig,PyObject *sigargs); +--- siplib/siplib.c 2005/08/25 21:02:16 453320 ++++ siplib/siplib.c 2006/10/11 14:34:14 594517 +@@ -28,12 +28,12 @@ + * These are the functions that make up the public and private SIP API. + */ + static void sip_api_bad_catcher_result(PyObject *method); +-static void sip_api_bad_length_for_slice(int seqlen,int slicelen); ++static void sip_api_bad_length_for_slice(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen); + static PyObject *sip_api_build_result(int *isErr,char *fmt,...); + static PyObject *sip_api_call_method(int *isErr,PyObject *method,char *fmt, + ...); + static PyObject *sip_api_class_name(PyObject *self); +-static int sip_api_convert_from_sequence_index(int idx,int len); ++static _SIP_SSIZE_T sip_api_convert_from_sequence_index(_SIP_SSIZE_T idx, _SIP_SSIZE_T len); + static void *sip_api_convert_to_cpp(PyObject *sipSelf,sipWrapperType *type, + int *iserrp); + static PyObject *sip_api_get_wrapper(void *cppPtr,sipWrapperType *type); +@@ -302,8 +302,11 @@ + + if (PyType_Ready(&sipWrapperType_Type) < 0) + Py_FatalError("sip: Failed to initialise sip.wrappertype type"); +- ++#if PY_VERSION_HEX >= 0x02050000 ++ if (PyType_Ready(&sipWrapper_Type.super.ht_type) < 0) ++#else + if (PyType_Ready(&sipWrapper_Type.super.type) < 0) ++#endif + Py_FatalError("sip: Failed to initialise sip.wrapper type"); + + if (PyType_Ready(&sipVoidPtr_Type) < 0) +@@ -671,7 +674,11 @@ + sipWrapperType *wt; + + while ((wt = *mw++) != NULL) ++#if PY_VERSION_HEX >= 0x02050000 ++ if (addInstances(wt -> super.ht_type.tp_dict,&wt -> type -> td_instances) < 0) ++#else + if (addInstances(wt -> super.type.tp_dict,&wt -> type -> td_instances) < 0) ++#endif + return -1; + } + +@@ -1568,7 +1575,11 @@ + type = va_arg(va,sipWrapperType *); + va_arg(va,void **); + ++#if PY_VERSION_HEX >= 0x02050000 ++ if (arg != Py_None && !PyObject_TypeCheck(arg,&type -> super.ht_type)) ++#else + if (arg != Py_None && !PyObject_TypeCheck(arg,&type -> super.type)) ++#endif + valid = PARSE_TYPE; + + /* Handle the sub-format. */ +@@ -1662,7 +1673,11 @@ + #if defined(SIP_QT_SUPPORT) + /* Sub-class of QObject. */ + ++#if PY_VERSION_HEX >= 0x02050000 ++ if (PyObject_TypeCheck(arg,&sipQObjectClass -> super.ht_type)) ++#else + if (PyObject_TypeCheck(arg,&sipQObjectClass -> super.type)) ++#endif + *va_arg(va,PyObject **) = arg; + else + valid = PARSE_TYPE; +@@ -2325,7 +2340,7 @@ + * Convert a sequence index. Return the index or a negative value if there was + * an error. + */ +-static int sip_api_convert_from_sequence_index(int idx,int len) ++static _SIP_SSIZE_T sip_api_convert_from_sequence_index(_SIP_SSIZE_T idx,_SIP_SSIZE_T len) + { + /* Negative indices start from the other end. */ + if (idx < 0) +@@ -2405,7 +2420,11 @@ + + /* Get the dictionary into which the type will be placed. */ + if (type -> td_scope >= 0) ++#if PY_VERSION_HEX >= 0x02050000 ++ dict = client -> em_types[type -> td_scope] -> super.ht_type.tp_dict; ++#else + dict = client -> em_types[type -> td_scope] -> super.type.tp_dict; ++#endif + else + dict = mod_dict; + +@@ -2474,7 +2493,11 @@ + + /* Get the dictionary into which the type will be placed. */ + if (ed -> e_scope >= 0) ++#if PY_VERSION_HEX >= 0x02050000 ++ dict = client -> em_types[ed -> e_scope] -> super.ht_type.tp_dict; ++#else + dict = client -> em_types[ed -> e_scope] -> super.type.tp_dict; ++#endif + else + dict = mod_dict; + +@@ -2597,7 +2620,11 @@ + + self = PyTuple_GET_ITEM(args,argnr); + ++#if PY_VERSION_HEX >= 0x02050000 ++ if (!PyObject_TypeCheck(self,&type -> super.ht_type)) ++#else + if (!PyObject_TypeCheck(self,&type -> super.type)) ++#endif + return PARSE_UNBOUND; + + *selfp = (sipWrapper *)self; +@@ -2700,7 +2727,11 @@ + if ((attr = createEnumMember(in, enm)) == NULL) + return NULL; + ++#if PY_VERSION_HEX >= 0x02050000 ++ if (PyDict_SetItem(in -> super.ht_type.tp_dict,nameobj,attr) < 0) ++#else + if (PyDict_SetItem(in -> super.type.tp_dict,nameobj,attr) < 0) ++#endif + { + Py_DECREF(attr); + return NULL; +@@ -2903,9 +2934,15 @@ + /* + * Report a sequence length that does not match the length of a slice. + */ +-static void sip_api_bad_length_for_slice(int seqlen,int slicelen) ++static void sip_api_bad_length_for_slice(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen) + { +- PyErr_Format(PyExc_ValueError,"attempt to assign sequence of size %d to slice of size %d",seqlen,slicelen); ++ PyErr_Format(PyExc_ValueError, ++#if PY_VERSION_HEX >= 0x02050000 ++ "attempt to assign sequence of size %zd to slice of size %zd", ++#else ++ "attempt to assign sequence of size %d to slice of size %d", ++#endif ++ seqlen,slicelen); + } + + +@@ -3329,7 +3366,11 @@ + { + /* If this is a wrapped type then get the type dictionary. */ + if (sipWrapperType_Check(dict)) ++#if PY_VERSION_HEX >= 0x02050000 ++ dict = ((sipWrapperType *)dict) -> super.ht_type.tp_dict; ++#else + dict = ((sipWrapperType *)dict) -> super.type.tp_dict; ++#endif + + return addSingleClassInstance(dict,name,cppPtr,wt,SIP_SIMPLE); + } +@@ -3620,7 +3661,11 @@ + * convertor might be able to convert the target type + * to something more specific. + */ ++#if PY_VERSION_HEX >= 0x02050000 ++ if (PyType_IsSubtype(&type -> super.ht_type,&scc -> scc_basetype -> super.ht_type)) ++#else + if (PyType_IsSubtype(&type -> super.type,&scc -> scc_basetype -> super.type)) ++#endif + { + sipWrapperType *subtype; + +@@ -4036,7 +4081,7 @@ + /* + * The type alloc slot. + */ +-static PyObject *sipWrapperType_alloc(PyTypeObject *self, int nitems) ++static PyObject *sipWrapperType_alloc(PyTypeObject *self, _SIP_SSIZE_T nitems) + { + PyObject *o; + +@@ -4077,8 +4122,11 @@ + * super-type. + */ + if (self -> type == NULL) ++#if PY_VERSION_HEX >= 0x02050000 ++ self -> type = ((sipWrapperType *)self -> super.ht_type.tp_base) -> type; ++#else + self -> type = ((sipWrapperType *)self -> super.type.tp_base) -> type; +- ++#endif + return 0; + } + +@@ -4107,8 +4155,11 @@ + PyObject *dict, *tmpdict, *proxy; + PyMethodDef *pmd; + ++#if PY_VERSION_HEX >= 0x02050000 ++ dict = wt -> super.ht_type.tp_dict; ++#else + dict = wt -> super.type.tp_dict; +- ++#endif + /* The base type doesn't have any type information. */ + if ((td = wt -> type) == NULL) + return PyDictProxy_New(dict); +@@ -4304,7 +4355,11 @@ + } + + /* Call the standard super-type new. */ ++#if PY_VERSION_HEX >= 0x02050000 ++ return PyBaseObject_Type.tp_new(&wt -> super.ht_type,args,kwds); ++#else + return PyBaseObject_Type.tp_new(&wt -> super.type,args,kwds); ++#endif + } + + +@@ -4744,8 +4799,13 @@ + switch (slots++ -> psd_type) + { + case str_slot: ++#if PY_VERSION_HEX >= 0x02050000 ++ if (sp -> ht_type.tp_str == NULL) ++ sp -> ht_type.tp_str = (reprfunc)f; ++#else + if (sp -> type.tp_str == NULL) + sp -> type.tp_str = (reprfunc)f; ++#endif + break; + + case int_slot: +@@ -4891,8 +4951,13 @@ + break; + + case call_slot: ++#if PY_VERSION_HEX >= 0x02050000 ++ if (sp -> ht_type.tp_call == NULL) ++ sp -> ht_type.tp_call = sipWrapper_call; ++#else + if (sp -> type.tp_call == NULL) + sp -> type.tp_call = sipWrapper_call; ++#endif + break; + + case getitem_slot: +@@ -4916,13 +4981,23 @@ + case ne_slot: + case gt_slot: + case ge_slot: ++#if PY_VERSION_HEX >= 0x02050000 ++ if (sp -> ht_type.tp_richcompare == NULL) ++ sp -> ht_type.tp_richcompare = sipWrapper_richcompare; ++#else + if (sp -> type.tp_richcompare == NULL) + sp -> type.tp_richcompare = sipWrapper_richcompare; ++#endif + break; + + case cmp_slot: ++#if PY_VERSION_HEX >= 0x02050000 ++ if (sp -> ht_type.tp_compare == NULL) ++ sp -> ht_type.tp_compare = (cmpfunc)f; ++#else + if (sp -> type.tp_compare == NULL) + sp -> type.tp_compare = (cmpfunc)f; ++#endif + break; + + case nonzero_slot: +@@ -4936,8 +5011,13 @@ + break; + + case repr_slot: ++#if PY_VERSION_HEX >= 0x02050000 ++ if (sp -> ht_type.tp_repr == NULL) ++ sp -> ht_type.tp_repr = (reprfunc)f; ++#else + if (sp -> type.tp_repr == NULL) + sp -> type.tp_repr = (reprfunc)f; ++#endif + break; + } + } diff --git a/dev-python/sip/sip-4.2.1-r1.ebuild b/dev-python/sip/sip-4.2.1-r1.ebuild new file mode 100644 index 000000000000..a505a39638ec --- /dev/null +++ b/dev-python/sip/sip-4.2.1-r1.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/sip/sip-4.2.1-r1.ebuild,v 1.1 2006/10/22 15:10:32 carlo Exp $ + +inherit distutils + +MY_P=${P/"?.?.?_pre"/"snapshot-"} +MY_P=${MY_P/_/} +S=${WORKDIR}/${MY_P} + +DESCRIPTION="SIP is a tool for generating bindings for C++ classes so that they can be used by Python." +HOMEPAGE="http://www.riverbankcomputing.co.uk/sip/" +SRC_URI="mirror://gentoo/${MY_P}.tar.gz" +#SRC_URI="http://www.river-bank.demon.co.uk/download/sip/${MY_P}.tar.gz" +#SRC_URI="http://www.river-bank.demon.co.uk/download/snapshots/sip/${MY_P}.tar.gz" + +SLOT="0" +LICENSE="sip" +KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86" +IUSE="debug doc" + +DEPEND="virtual/libc + x11-libs/qt + >=dev-lang/python-2.3" +RDEPEND="${DEPEND}" + +src_unpack(){ + unpack ${A} + cd ${S} + epatch "${FILESDIR}/sip-4.2.1-python-2.5-compat.diff" +} +src_compile(){ + distutils_python_version + + local myconf="-l qt-mt -b ${ROOT}usr/bin -d ${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages -e ${ROOT}usr/include/python${PYVER}" + use debug && myconf="${myconf} -u" + + python configure.py ${myconf} "CFLAGS+=${CFLAGS}" "CXXFLAGS+=${CXXFLAGS}" + emake || die "emake failed" +} + +src_install() { + make DESTDIR=${D} install || die "install failed" + dodoc ChangeLog LICENSE NEWS README THANKS TODO + if use doc ; then dohtml doc/* ; fi +} + +pkg_postinst() { + echo "" + einfo "Please note, that you have to emerge PyQt again, when upgrading from sip-3.x." + echo "" +} |