diff options
author | Mike Hommey <mh@glandium.org> | 2004-05-17 06:56:59 +0000 |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2004-05-17 06:56:59 +0000 |
commit | d4e028c96af89ade493b440d4f2de6b684c03a06 (patch) | |
tree | 4b74b3cd4b14524309bc5a3e776d81d4bbc5efe4 /python | |
parent | 81bcf076ea11e114a60e429338a15748066de163 (diff) | |
download | libxml2-d4e028c96af89ade493b440d4f2de6b684c03a06.tar.gz |
Load /tmp/tmp.QVLX5b/libxml2-2.6.10 intoupstream/2.6.10
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python')
-rwxr-xr-x | python/generator.py | 12 | ||||
-rw-r--r-- | python/libxml.c | 18 | ||||
-rw-r--r-- | python/libxml2-py.c | 82 | ||||
-rwxr-xr-x | python/setup.py | 2 | ||||
-rw-r--r-- | python/tests/Makefile.am | 2 | ||||
-rw-r--r-- | python/tests/Makefile.in | 2 | ||||
-rwxr-xr-x | python/tests/tstLastError.py | 2 |
7 files changed, 83 insertions, 37 deletions
diff --git a/python/generator.py b/python/generator.py index 0891eed..4c6c8ab 100755 --- a/python/generator.py +++ b/python/generator.py @@ -432,7 +432,7 @@ def print_function_wrapper(name, output, export, include): include.write("#ifdef LIBXML_DEBUG_ENABLED\n"); export.write("#ifdef LIBXML_DEBUG_ENABLED\n"); output.write("#ifdef LIBXML_DEBUG_ENABLED\n"); - elif file == "HTMLtree" or file == "HTMLparser": + elif file == "HTMLtree" or file == "HTMLparser" or name[0:4] == "html": include.write("#ifdef LIBXML_HTML_ENABLED\n"); export.write("#ifdef LIBXML_HTML_ENABLED\n"); output.write("#ifdef LIBXML_HTML_ENABLED\n"); @@ -470,9 +470,17 @@ def print_function_wrapper(name, output, export, include): if file == "python": # Those have been manually generated + if name[0:4] == "html": + include.write("#endif /* LIBXML_HTML_ENABLED */\n"); + export.write("#endif /* LIBXML_HTML_ENABLED */\n"); + output.write("#endif /* LIBXML_HTML_ENABLED */\n"); return 1 if file == "python_accessor" and ret[0] != "void" and ret[2] is None: # Those have been manually generated + if name[0:4] == "html": + include.write("#endif /* LIBXML_HTML_ENABLED */\n"); + export.write("#endif /* LIBXML_HTML_ENABLED */\n"); + output.write("#endif /* LIBXML_HTML_ENABLED */\n"); return 1 output.write("PyObject *\n") @@ -501,7 +509,7 @@ def print_function_wrapper(name, output, export, include): include.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); export.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); output.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); - elif file == "HTMLtree" or file == "HTMLparser": + elif file == "HTMLtree" or file == "HTMLparser" or name[0:4] == "html": include.write("#endif /* LIBXML_HTML_ENABLED */\n"); export.write("#endif /* LIBXML_HTML_ENABLED */\n"); output.write("#endif /* LIBXML_HTML_ENABLED */\n"); diff --git a/python/libxml.c b/python/libxml.c index 7a19303..4ab69fb 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -1190,6 +1190,7 @@ PyObject * libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) { +#ifdef LIBXML_HTML_ENABLED const char *chunk; int size; const char *URI; @@ -1216,6 +1217,10 @@ libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self, XML_CHAR_ENCODING_NONE); pyret = libxml_xmlParserCtxtPtrWrap(ret); return (pyret); +#else + Py_INCREF(Py_None); + return (Py_None); +#endif /* LIBXML_HTML_ENABLED */ } PyObject * @@ -1249,6 +1254,7 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) PyObject * libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) { +#ifdef LIBXML_HTML_ENABLED const char *URI; const char *encoding; PyObject *pyobj_SAX = NULL; @@ -1273,6 +1279,10 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX); Py_INCREF(Py_None); return (Py_None); +#else + Py_INCREF(Py_None); + return (Py_None); +#endif /* LIBXML_HTML_ENABLED */ } /************************************************************************ @@ -2430,6 +2440,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) xmlDocDumpFormatMemoryEnc(doc, &c_retval, &len, (const char *) encoding, format); py_retval = libxml_charPtrWrap((char *) c_retval); +#ifdef LIBXML_HTML_ENABLED } else if (node->type == XML_HTML_DOCUMENT_NODE) { xmlOutputBufferPtr buf; xmlCharEncodingHandlerPtr handler = NULL; @@ -2473,6 +2484,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } (void) xmlOutputBufferClose(buf); py_retval = libxml_charPtrWrap((char *) c_retval); +#endif /* LIBXML_HTML_ENABLED */ } else { if (node->type == XML_NAMESPACE_DECL) doc = NULL; @@ -2508,6 +2520,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } (void) xmlOutputBufferClose(buf); py_retval = libxml_charPtrWrap((char *) c_retval); +#ifdef LIBXML_HTML_ENABLED } else if (doc->type == XML_HTML_DOCUMENT_NODE) { xmlOutputBufferPtr buf; xmlCharEncodingHandlerPtr handler = NULL; @@ -2549,6 +2562,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } (void) xmlOutputBufferClose(buf); py_retval = libxml_charPtrWrap((char *) c_retval); +#endif /* LIBXML_HTML_ENABLED */ } else { Py_INCREF(Py_None); return (Py_None); @@ -2594,10 +2608,12 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } else { doc = node->doc; } +#ifdef LIBXML_HTML_ENABLED if (doc->type == XML_HTML_DOCUMENT_NODE) { if (encoding == NULL) encoding = (const char *) htmlGetMetaEncoding(doc); } +#endif /* LIBXML_HTML_ENABLED */ if (encoding != NULL) { handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) { @@ -2614,12 +2630,14 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) buf = xmlOutputBufferCreateFile(output, handler); if (node->type == XML_DOCUMENT_NODE) { len = xmlSaveFormatFileTo(buf, doc, encoding, format); +#ifdef LIBXML_HTML_ENABLED } else if (node->type == XML_HTML_DOCUMENT_NODE) { htmlDocContentDumpFormatOutput(buf, doc, encoding, format); len = xmlOutputBufferClose(buf); } else if (doc->type == XML_HTML_DOCUMENT_NODE) { htmlNodeDumpFormatOutput(buf, doc, node, encoding, format); len = xmlOutputBufferClose(buf); +#endif /* LIBXML_HTML_ENABLED */ } else { xmlNodeDumpOutput(buf, doc, node, 0, format, encoding); len = xmlOutputBufferClose(buf); diff --git a/python/libxml2-py.c b/python/libxml2-py.c index 2e3bf22..f70d4f8 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -721,6 +721,7 @@ libxml_xmlCatalogIsEmpty(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +#ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlInitAutoClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { @@ -729,6 +730,7 @@ libxml_htmlInitAutoClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBU return(Py_None); } +#endif /* LIBXML_HTML_ENABLED */ PyObject * libxml_xmlTextReaderReadOuterXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -1533,6 +1535,7 @@ libxml_xmlParseMarkupDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +#ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -1548,6 +1551,7 @@ libxml_htmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) return(py_retval); } +#endif /* LIBXML_HTML_ENABLED */ PyObject * libxml_xmlHasNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -3198,6 +3202,16 @@ libxml_xmlUCSIsCombiningMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObjec } PyObject * +libxml_xmlPopInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { + PyObject *py_retval; + int c_retval; + + c_retval = xmlPopInputCallbacks(); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlUCSIsCatSc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -6023,22 +6037,6 @@ libxml_xmlURIGetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * -libxml_xmlTextReaderGetRemainder(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserInputBufferPtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetRemainder", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetRemainder(reader); - py_retval = libxml_xmlParserInputBufferPtrWrap((xmlParserInputBufferPtr) c_retval); - return(py_retval); -} - -PyObject * libxml_xmlUCSIsCatC(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -8349,6 +8347,7 @@ libxml_xmlResetError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +#ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { @@ -8357,6 +8356,7 @@ libxml_htmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args return(Py_None); } +#endif /* LIBXML_HTML_ENABLED */ #ifdef LIBXML_DEBUG_ENABLED PyObject * libxml_xmlShellPrintXPathError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -8502,6 +8502,8 @@ libxml_xmlUnlinkNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +#ifdef LIBXML_HTML_ENABLED +#endif /* LIBXML_HTML_ENABLED */ PyObject * libxml_xmlCopyCharMultiByte(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -8748,6 +8750,21 @@ libxml_xmlParseSystemLiteral(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlStrcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlChar * str1; + xmlChar * str2; + + if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcmp", &str1, &str2)) + return(NULL); + + c_retval = xmlStrcmp(str1, str2); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlDocSetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; @@ -10327,6 +10344,8 @@ libxml_xmlTextMerge(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +#ifdef LIBXML_HTML_ENABLED +#endif /* LIBXML_HTML_ENABLED */ #ifdef LIBXML_XPATH_ENABLED PyObject * libxml_xmlXPathStringLengthFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -11112,21 +11131,6 @@ libxml_xmlXPathVariableLookupNS(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) } #endif /* LIBXML_XPATH_ENABLED */ -PyObject * -libxml_xmlStrcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcmp", &str1, &str2)) - return(NULL); - - c_retval = xmlStrcmp(str1, str2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - #ifdef LIBXML_XINCLUDE_ENABLED PyObject * libxml_xmlXIncludeProcessFlags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -12508,6 +12512,22 @@ libxml_xmlUCSIsLetterlikeSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args } PyObject * +libxml_xmlTextReaderGetRemainder(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlParserInputBufferPtr c_retval; + xmlTextReaderPtr reader; + PyObject *pyobj_reader; + + if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetRemainder", &pyobj_reader)) + return(NULL); + reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); + + c_retval = xmlTextReaderGetRemainder(reader); + py_retval = libxml_xmlParserInputBufferPtrWrap((xmlParserInputBufferPtr) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlUCSIsCatZp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; diff --git a/python/setup.py b/python/setup.py index 1d342ac..5bafd54 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.9", + version = "2.6.10", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 584ddbc..bf04878 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -45,7 +45,7 @@ EXTRA_DIST = $(PYTESTS) $(XMLS) if WITH_PYTHON tests: $(PYTESTS) - -@(PYTHONPATH="..:../.libs:$(srcdir)/.." ; export PYTHONPATH; \ + -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; export PYTHONPATH; \ for test in $(PYTESTS) ; do echo "-- $$test" ; $(PYTHON) $(srcdir)/$$test ; done) else tests: diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index cd259be..893a517 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -444,7 +444,7 @@ uninstall-am: uninstall-info-am @WITH_PYTHON_TRUE@tests: $(PYTESTS) -@WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/.." ; export PYTHONPATH; \ +@WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; export PYTHONPATH; \ @WITH_PYTHON_TRUE@ for test in $(PYTESTS) ; do echo "-- $$test" ; $(PYTHON) $(srcdir)/$$test ; done) @WITH_PYTHON_FALSE@tests: diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py index 83e98b8..442609c 100755 --- a/python/tests/tstLastError.py +++ b/python/tests/tstLastError.py @@ -21,7 +21,7 @@ class TestCase(unittest.TestCase): # disable the default error handler libxml2.registerErrorHandler(None,None) try: - f(*args) + apply(f,args) except exc: e = libxml2.lastError() if e is None: |