From ebe37292fa612f872c072be0cd34c4aca9927a3f Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Feb 18 2014 15:58:27 +0000 Subject: Upstream 0.6.10. --- diff --git a/.gitignore b/.gitignore index 5d58e46..a6d1bf2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ meld3-0.6.5.tar.gz /meld3-0.6.7.tar.gz +/meld3-0.6.10.tar.gz diff --git a/python-meld3-0.6.7-missing-src-file.patch b/python-meld3-0.6.7-missing-src-file.patch deleted file mode 100644 index 8aa907f..0000000 --- a/python-meld3-0.6.7-missing-src-file.patch +++ /dev/null @@ -1,399 +0,0 @@ -diff -up meld3-0.6.7/meld3/cmeld3.c.missing-src-file meld3-0.6.7/meld3/cmeld3.c ---- meld3-0.6.7/meld3/cmeld3.c.missing-src-file 2011-04-05 14:31:26.229563043 +0200 -+++ meld3-0.6.7/meld3/cmeld3.c 2011-04-05 14:30:52.631796235 +0200 -@@ -0,0 +1,395 @@ -+#include -+ -+/* fprintf(stderr, "%s:%s:%d\n", __FILE__,__FUNCTION__,__LINE__); -+ fflush(stderr); */ -+ -+static PyObject *PySTR__class__, *PySTR__dict__, *PySTR_children; -+static PyObject *PySTRattrib, *PySTRparent, *PySTR_MELD_ID; -+static PyObject *PySTRtag, *PySTRtext, *PySTRtail, *PySTRstructure; -+static PyObject *PySTRReplace; -+ -+static PyObject *emptyattrs, *emptychildren = NULL; -+ -+static PyObject* -+bfclone(PyObject *nodes, PyObject *parent) -+{ -+ int len, i; -+ -+ if (!(PyList_Check(nodes))) { -+ return NULL; -+ } -+ -+ len = PyList_Size(nodes); -+ -+ if (len < 0) { -+ return NULL; -+ } -+ -+ PyObject *L; -+ if (!(L = PyList_New(0))) return NULL; -+ -+ for (i = 0; i < len; i++) { -+ -+ PyObject *node; -+ -+ if (!(node = PyList_GetItem(nodes, i))) { -+ return NULL; -+ } -+ -+ PyObject *klass; -+ PyObject *children; -+ PyObject *text; -+ PyObject *tail; -+ PyObject *tag; -+ PyObject *attrib; -+ PyObject *structure; -+ PyObject *dict; -+ PyObject *newdict; -+ PyObject *newchildren; -+ PyObject *attrib_copy; -+ PyObject *element; -+ int childsize; -+ -+ if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL; -+ if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL; -+ -+ if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL; -+ if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL; -+ if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL; -+ -+ if (!(text = PyDict_GetItem(dict, PySTRtext))) { -+ text = Py_None; -+ } -+ if (!(tail = PyDict_GetItem(dict, PySTRtail))) { -+ tail = Py_None; -+ } -+ if (!(structure = PyDict_GetItem(dict, PySTRstructure))) { -+ structure = Py_None; -+ } -+ Py_DECREF(dict); -+ -+ if (!(newdict = PyDict_New())) return NULL; -+ if (!(newchildren = PyList_New(0))) return NULL; -+ -+ attrib_copy = PyDict_Copy(attrib); -+ -+ PyDict_SetItem(newdict, PySTR_children, newchildren); -+ Py_DECREF(newchildren); -+ PyDict_SetItem(newdict, PySTRattrib, attrib_copy); -+ Py_DECREF(attrib_copy); -+ PyDict_SetItem(newdict, PySTRtext, text); -+ PyDict_SetItem(newdict, PySTRtail, tail); -+ PyDict_SetItem(newdict, PySTRtag, tag); -+ PyDict_SetItem(newdict, PySTRstructure, structure); -+ PyDict_SetItem(newdict, PySTRparent, parent); -+ -+ if (!(element = PyInstance_NewRaw(klass, newdict))) { -+ return NULL; -+ } -+ -+ Py_DECREF(newdict); -+ Py_DECREF(klass); -+ -+ if (PyList_Append(L, element)) { -+ return NULL; -+ } -+ Py_DECREF(element); -+ -+ if (!PyList_Check(children)) return NULL; -+ -+ if ((childsize = PyList_Size(children)) < 0) { -+ return NULL; -+ } -+ else { -+ if (childsize > 0) { -+ bfclone(children, element); -+ } -+ } -+ } -+ -+ if (PyObject_SetAttr(parent, PySTR_children, L)) return NULL; -+ Py_DECREF(L); -+ return parent; -+ -+} -+ -+static PyObject* -+bfclonehandler(PyObject *self, PyObject *args) -+{ -+ PyObject *node, *parent; -+ -+ if (!PyArg_ParseTuple(args, "OO:clone", &node, &parent)) { -+ return NULL; -+ } -+ -+ PyObject *klass; -+ PyObject *children; -+ PyObject *text; -+ PyObject *tail; -+ PyObject *tag; -+ PyObject *attrib; -+ PyObject *structure; -+ PyObject *dict; -+ PyObject *newdict; -+ PyObject *newchildren; -+ PyObject *attrib_copy; -+ PyObject *element; -+ -+ if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL; -+ if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL; -+ -+ if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL; -+ if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL; -+ if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL; -+ -+ if (!(text = PyDict_GetItem(dict, PySTRtext))) { -+ text = Py_None; -+ } -+ if (!(tail = PyDict_GetItem(dict, PySTRtail))) { -+ tail = Py_None; -+ } -+ if (!(structure = PyDict_GetItem(dict, PySTRstructure))) { -+ structure = Py_None; -+ } -+ -+ Py_DECREF(dict); -+ -+ if (!(newdict = PyDict_New())) return NULL; -+ if (!(newchildren = PyList_New(0))) return NULL; -+ -+ attrib_copy = PyDict_Copy(attrib); -+ -+ PyDict_SetItem(newdict, PySTR_children, newchildren); -+ Py_DECREF(newchildren); -+ PyDict_SetItem(newdict, PySTRattrib, attrib_copy); -+ Py_DECREF(attrib_copy); -+ PyDict_SetItem(newdict, PySTRtext, text); -+ PyDict_SetItem(newdict, PySTRtail, tail); -+ PyDict_SetItem(newdict, PySTRtag, tag); -+ PyDict_SetItem(newdict, PySTRstructure, structure); -+ PyDict_SetItem(newdict, PySTRparent, parent); -+ -+ if (!(element = PyInstance_NewRaw(klass, newdict))) return NULL; -+ Py_DECREF(newdict); -+ Py_DECREF(klass); -+ -+ PyObject *pchildren; -+ -+ if (parent != Py_None) { -+ if (!(pchildren=PyObject_GetAttr(parent, PySTR_children))) return NULL; -+ if (PyList_Append(pchildren, element)) return NULL; -+ Py_DECREF(pchildren); -+ } -+ -+ if (!(PyList_Check(children))) return NULL; -+ -+ if (PyList_Size(children) > 0) { -+ if (bfclone(children, element) == NULL) { -+ return NULL; -+ } -+ } -+ return element; -+ -+} -+ -+PyDoc_STRVAR(bfclonehandler_doc, -+"bfclone(node, parent=None)\n \ -+\n\ -+Return a clone of the meld3 node named by node (breadth-first). If parent\n\ -+is not None, append the clone to the parent.\n"); -+ -+static PyObject* -+getiterator(PyObject *node, PyObject *list) { -+ if (PyList_Append(list, node) == -1) { -+ return NULL; -+ } -+ PyObject *children; -+ PyObject *child; -+ -+ if (!(children = PyObject_GetAttr(node, PySTR_children))) { -+ return NULL; -+ } -+ -+ int len, i; -+ len = PyList_Size(children); -+ if (len < 0) { -+ return NULL; -+ } -+ -+ for (i = 0; i < len; i++) { -+ if (!(child = PyList_GetItem(children, i))) { -+ return NULL; -+ } -+ getiterator(child, list); -+ } -+ -+ Py_DECREF(children); -+ return list; -+} -+ -+static PyObject* -+getiteratorhandler(PyObject *self, PyObject *args) -+{ -+ PyObject *node; -+ -+ if (!PyArg_ParseTuple(args, "O:getiterator", &node)) { -+ return NULL; -+ } -+ PyObject *list; -+ PyObject *result; -+ if (!(list = PyList_New(0))) { -+ return NULL; -+ } -+ result = getiterator(node, list); -+ if (result == NULL) { -+ PyList_SetSlice(list, 0, PyList_GET_SIZE(list), (PyObject *)NULL); -+ Py_DECREF(list); -+ } -+ return result; -+} -+ -+PyDoc_STRVAR(getiteratorhandler_doc, -+"getiterator(node)\n\ -+\n\ -+Returns an iterator for the node."); -+ -+static char* _MELD_ID = "{http://www.plope.com/software/meld3}id"; -+/*static PyObject *PySTR_MELD_ID = PyString_FromString(_MELD_ID);*/ -+ -+static PyObject* -+findmeld(PyObject *node, PyObject *name) { -+ PyObject *attrib, *meldid, *result; -+ if (!(attrib = PyObject_GetAttr(node, PySTRattrib))) return NULL; -+ meldid = PyDict_GetItem(attrib, PySTR_MELD_ID); -+ Py_DECREF(attrib); -+ -+ if (meldid != NULL) { -+ int compareresult = PyUnicode_Compare(meldid, name); -+ if (compareresult == 0) { -+ Py_INCREF(node); -+ return node; -+ } -+ } -+ -+ int len, i; -+ result = Py_None; -+ PyObject *children = PyObject_GetAttr(node, PySTR_children); -+ len = PyList_Size(children); -+ for (i = 0; i < len; i++) { -+ PyObject *child = PyList_GetItem(children, i); -+ result = findmeld(child, name); -+ if (result != Py_None) { -+ break; -+ } -+ } -+ Py_DECREF(children); -+ -+ return result; -+ -+} -+ -+static PyObject* -+findmeldhandler(PyObject *self, PyObject *args) -+{ -+ PyObject *node, *name, *result; -+ -+ if (!PyArg_ParseTuple(args, "OO:findmeld", &node, &name)) { -+ return NULL; -+ } -+ if (!(result = findmeld(node, name))) return NULL; -+ -+ if (result == Py_None) { -+ Py_INCREF(Py_None); -+ } -+ -+ return result; -+} -+ -+PyDoc_STRVAR(findmeldhandler_doc, -+"findmeld(node, meldid)\n\ -+\n\ -+Return a meld node or None.\n"); -+ -+static PyObject* -+contenthandler(PyObject *self, PyObject *args) { -+ PyObject *node, *text, *structure; -+ -+ if (!PyArg_ParseTuple(args, "OOO:content", &node, &text, &structure)) { -+ return NULL; -+ } -+ PyObject *replacel = NULL; -+ PyObject *replace = NULL; -+ PyObject *replacenode = NULL; -+ PyObject *newchildren = NULL; -+ PyObject *newdict = NULL; -+ PyObject *klass = NULL; -+ -+ if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL; -+ if (!(replacel = PyObject_GetAttr(node, PySTRReplace))) return NULL; -+ if (!(replace = PyList_GetItem(replacel, 0))) return NULL; -+ Py_DECREF(replacel); -+ -+ PyObject_SetAttr(node, PySTRtext, Py_None); -+ -+ if (!(newdict = PyDict_New())) return NULL; -+ -+ if (PyDict_SetItem(newdict, PySTRparent, node) == -1) return NULL; -+ if (PyDict_SetItem(newdict, PySTRattrib, emptyattrs) == -1) return NULL; -+ if (PyDict_SetItem(newdict, PySTRtext, text) == -1) return NULL; -+ if (PyDict_SetItem(newdict, PySTRstructure, structure) == -1) return NULL; -+ if (PyDict_SetItem(newdict, PySTRtag, replace) == -1) return NULL; -+ if (PyDict_SetItem(newdict, PySTR_children, emptychildren) == -1) { -+ return NULL; -+ } -+ if (!(replacenode = PyInstance_NewRaw(klass, newdict))) return NULL; -+ Py_DECREF(klass); -+ Py_DECREF(newdict); -+ -+ if (!(newchildren = PyList_New(1))) return NULL; -+ PyList_SET_ITEM(newchildren, 0, replacenode); // steals a reference to rn -+ PyObject_SetAttr(node, PySTR_children, newchildren); -+ Py_DECREF(newchildren); -+ Py_INCREF(Py_None); -+ return Py_None; -+ -+} -+ -+PyDoc_STRVAR(contenthandler_doc, -+"content(node, text, structure)\n\ -+\n\ -+Add a content node to node."); -+ -+static PyMethodDef methods[] = { -+ {"bfclone", bfclonehandler, METH_VARARGS, bfclonehandler_doc}, -+ {"getiterator", getiteratorhandler, METH_VARARGS, getiteratorhandler_doc}, -+ {"findmeld", findmeldhandler, METH_VARARGS, findmeldhandler_doc}, -+ {"content", contenthandler, METH_VARARGS, contenthandler_doc}, -+ {NULL, NULL} -+}; -+ -+PyMODINIT_FUNC -+initcmeld3(void) -+{ -+#define DEFINE_STRING(s) \ -+ if (!(PySTR##s = PyString_FromString(#s))) return -+ DEFINE_STRING(__class__); -+ DEFINE_STRING(__dict__); -+ DEFINE_STRING(_children); -+ DEFINE_STRING(parent); -+ DEFINE_STRING(tag); -+ DEFINE_STRING(attrib); -+ DEFINE_STRING(text); -+ DEFINE_STRING(tail); -+ DEFINE_STRING(structure); -+ DEFINE_STRING(Replace); -+#undef DEFINE_STRING -+ PySTR_MELD_ID = PyString_FromString(_MELD_ID); -+ if (!PySTR_MELD_ID) { -+ return; -+ } -+ emptyattrs = PyDict_New(); -+/* emptyattrs = PyDictProxy_New(emptyattrs); can't copy a proxy, so... */ -+ emptychildren = PyList_New(0); -+ Py_InitModule3("cmeld3", methods, -+ "C helpers for meld3"); -+} diff --git a/python-meld3.spec b/python-meld3.spec index 991f93a..5a5e3a1 100644 --- a/python-meld3.spec +++ b/python-meld3.spec @@ -1,27 +1,16 @@ -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Summary: HTML/XML templating system for Python Name: python-meld3 -Version: 0.6.7 -Release: 7%{?dist} +Version: 0.6.10 +Release: 1%{?dist} License: ZPLv2.1 Group: Development/Languages URL: http://www.plope.com/software/meld3/ Source0: http://pypi.python.org/packages/source/m/meld3/meld3-%{version}.tar.gz -# The current meld3 tarball leaves this out by mistake -# https://github.com/Supervisor/meld3/raw/0.6.7/meld3/cmeld3.c -- AKA: -# https://github.com/Supervisor/meld3/raw/bafd959fc2e389f46786a6b3174d50f9963fe967/meld3/cmeld3.c -Patch0: python-meld3-0.6.7-missing-src-file.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -%if 0%{?rhel} && 0%{?rhel} <= 5 -BuildRequires: python-elementtree -Requires: python-elementtree -%endif - BuildRequires: python-devel - %description meld3 is an HTML/XML templating system for Python 2.3+ which keeps template markup and dynamic rendering logic separate from one another. See @@ -29,7 +18,6 @@ http://www.entrian.com/PyMeld for a treatise on the benefits of this pattern. %prep %setup -q -n meld3-%{version} -%patch0 -p1 -b .missing-src-file %build export USE_MELD3_EXTENSION_MODULES=True @@ -54,6 +42,9 @@ rm -rf %{buildroot} %{python_sitearch}/* %changelog +* Mon Feb 3 2014 Steve Traylen - 0.6.10-1 +- Upstream 0.6.10. + * Thu Feb 14 2013 Fedora Release Engineering - 0.6.7-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild @@ -91,7 +82,7 @@ rm -rf %{buildroot} * Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.6.4-2 - Rebuild for Python 2.6 -* Tue Feb 28 2008 Toshio Kuratomi 0.6.4-1 +* Thu Feb 28 2008 Toshio Kuratomi 0.6.4-1 - Update to 0.6.4. - Fix python-2.5 elementtree problem. diff --git a/sources b/sources index bccfc15..5cf968c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -53e589482029ee84ffac9362db71eabe meld3-0.6.7.tar.gz +42e58624e9d427be7659d7a28e2b0b6f meld3-0.6.10.tar.gz