From e85cf827a804d9abf4cbf48af6394c49331de322 Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Mon, 21 Sep 2015 22:55:55 +0800 Subject: Revert "Merge tag 'upstream/2.9.1+dfsg1'" This reverts commit 21ee18bdbc9a9d4500e12a1399d51c593b8b31d4, reversing changes made to de338c1adfa336ddb5177ceb5c63bcd868a0ebc7. --- python/Makefile.in | 292 ++++++++++++++++++++++++++--------------------- python/drv_libxml2.py | 18 ++- python/generator.py | 2 +- python/libxml.c | 5 +- python/libxml.py | 6 +- python/libxml2-export.c | 8 +- python/libxml2-py.c | 116 +++++++++---------- python/libxml2-py.h | 8 +- python/libxml2.py | 12 +- python/libxml2class.py | 6 +- python/libxml_wrap.h | 4 +- python/setup.py | 88 +++++++------- python/setup.py.in | 86 +++++++------- python/tests/Makefile.in | 110 ++++++++++++------ python/tests/sync.py | 29 ++--- python/types.c | 6 +- 16 files changed, 439 insertions(+), 357 deletions(-) (limited to 'python') diff --git a/python/Makefile.in b/python/Makefile.in index efdea43..03fbd5b 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,23 +16,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -53,14 +80,14 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python -DIST_COMMON = README $(am__dist_python_DATA_DIST) $(dist_docs_DATA) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/setup.py.in TODO +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/setup.py.in $(top_srcdir)/depcomp $(dist_docs_DATA) \ + $(am__dist_python_DATA_DIST) README TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -106,10 +133,23 @@ libxml2mod_la_OBJECTS = $(am_libxml2mod_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = libxml2mod_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libxml2mod_la_LDFLAGS) $(LDFLAGS) -o $@ @WITH_PYTHON_TRUE@am_libxml2mod_la_rpath = -rpath $(pythondir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -122,29 +162,26 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libxml2mod_la_SOURCES) DIST_SOURCES = $(am__libxml2mod_la_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -154,9 +191,29 @@ am__dist_python_DATA_DIST = drv_libxml2.py libxml2.py DATA = $(dist_docs_DATA) $(dist_python_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -271,6 +328,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_LIBS = @PYTHON_LIBS@ @@ -483,6 +543,7 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + install-pythonLTLIBRARIES: $(python_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \ @@ -509,12 +570,15 @@ uninstall-pythonLTLIBRARIES: clean-pythonLTLIBRARIES: -test -z "$(python_LTLIBRARIES)" || rm -f $(python_LTLIBRARIES) - @list='$(python_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(python_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libxml2mod.la: $(libxml2mod_la_OBJECTS) $(libxml2mod_la_DEPENDENCIES) $(EXTRA_libxml2mod_la_DEPENDENCIES) $(AM_V_CCLD)$(libxml2mod_la_LINK) $(am_libxml2mod_la_rpath) $(libxml2mod_la_OBJECTS) $(libxml2mod_la_LIBADD) $(LIBS) @@ -598,22 +662,25 @@ uninstall-dist_pythonDATA: dir='$(DESTDIR)$(pythondir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -628,57 +695,12 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -694,12 +716,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -711,15 +728,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -728,6 +741,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -903,13 +931,12 @@ ps-am: uninstall-am: uninstall-dist_docsDATA uninstall-dist_pythonDATA \ uninstall-pythonLTLIBRARIES -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ - ctags-recursive install install-am install-strip \ - tags-recursive +.MAKE: $(am__recursive_targets) all check install install-am \ + install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - clean-pythonLTLIBRARIES ctags ctags-recursive distclean \ +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool \ + clean-pythonLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ @@ -921,9 +948,8 @@ uninstall-am: uninstall-dist_docsDATA uninstall-dist_pythonDATA \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-dist_docsDATA uninstall-dist_pythonDATA \ - uninstall-pythonLTLIBRARIES + tags tags-am uninstall uninstall-am uninstall-dist_docsDATA \ + uninstall-dist_pythonDATA uninstall-pythonLTLIBRARIES # libxml.c #includes libxml2-export.c diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py index e43fb1d..c2ec3e2 100644 --- a/python/drv_libxml2.py +++ b/python/drv_libxml2.py @@ -34,12 +34,18 @@ TODO """ -__author__ = u"Stéphane Bidoul " +__author__ = "Stéphane Bidoul " __version__ = "0.3" +import sys import codecs -from types import StringType, UnicodeType -StringTypes = (StringType,UnicodeType) + +if sys.version_info[0] < 3: + __author__ = codecs.unicode_escape_decode(__author__)[0] + + StringTypes = (str, unicode) +else: + StringTypes = str from xml.sax._exceptions import * from xml.sax import xmlreader, saxutils @@ -65,9 +71,9 @@ def _d(s): try: import libxml2 -except ImportError, e: +except ImportError: raise SAXReaderNotAvailable("libxml2 not available: " \ - "import error was: %s" % e) + "import error was: %s" % sys.exc_info()[1]) class Locator(xmlreader.Locator): """SAX Locator adapter for libxml2.xmlTextReaderLocator""" @@ -134,7 +140,7 @@ class LibXml2Reader(xmlreader.XMLReader): self.__parsing = 1 try: # prepare source and create reader - if type(source) in StringTypes: + if isinstance(source, StringTypes): reader = libxml2.newTextReaderFilename(source) else: source = saxutils.prepare_input_source(source) diff --git a/python/generator.py b/python/generator.py index 82109e3..c0cb3ad 100755 --- a/python/generator.py +++ b/python/generator.py @@ -597,7 +597,7 @@ classes_type = { "xmlNodePtr": ("._o", "xmlNode(_obj=%s)", "xmlNode"), "xmlNode *": ("._o", "xmlNode(_obj=%s)", "xmlNode"), "xmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), - "xmlDocPtr *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), + "xmlDoc *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), "htmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), "htmlxmlDocPtr *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), "xmlAttrPtr": ("._o", "xmlAttr(_obj=%s)", "xmlAttr"), diff --git a/python/libxml.c b/python/libxml.c index 03cfb9f..30b71f3 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -296,7 +296,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) { #ifdef PyUnicode_Check } else if PyUnicode_Check (ret) { #if PY_VERSION_HEX >= 0x03030000 - size_t size; + Py_ssize_t size; const char *tmp; /* tmp doesn't need to be deallocated */ @@ -361,7 +361,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) { #ifdef PyUnicode_Check } else if PyUnicode_Check (ret) { #if PY_VERSION_HEX >= 0x03030000 - size_t size; + Py_ssize_t size; const char *tmp; /* tmp doesn't need to be deallocated */ @@ -2683,6 +2683,7 @@ libxml_last(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) xmlAttrPtr attr = (xmlAttrPtr) cur; res = attr->last; + break; } default: res = NULL; diff --git a/python/libxml.py b/python/libxml.py index e507e0f..2466cc9 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -530,7 +530,7 @@ class xmlCoreDepthFirstItertor: self.parents = [] def __iter__(self): return self - def next(self): + def __next__(self): while 1: if self.node: ret = self.node @@ -542,6 +542,7 @@ class xmlCoreDepthFirstItertor: except IndexError: raise StopIteration self.node = parent.next + next = __next__ # # implements the breadth-first iterator for libxml2 DOM tree @@ -552,7 +553,7 @@ class xmlCoreBreadthFirstItertor: self.parents = [] def __iter__(self): return self - def next(self): + def __next__(self): while 1: if self.node: ret = self.node @@ -564,6 +565,7 @@ class xmlCoreBreadthFirstItertor: except IndexError: raise StopIteration self.node = parent.children + next = __next__ # # converters to present a nicer view of the XPath returns diff --git a/python/libxml2-export.c b/python/libxml2-export.c index f7d96e1..84073ea 100644 --- a/python/libxml2-export.c +++ b/python/libxml2-export.c @@ -166,9 +166,9 @@ { (char *)"xmlAddDtdEntity", libxml_xmlAddDtdEntity, METH_VARARGS, NULL }, { (char *)"xmlAddEncodingAlias", libxml_xmlAddEncodingAlias, METH_VARARGS, NULL }, { (char *)"xmlAddNextSibling", libxml_xmlAddNextSibling, METH_VARARGS, NULL }, -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) { (char *)"xmlAddPrevSibling", libxml_xmlAddPrevSibling, METH_VARARGS, NULL }, -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ { (char *)"xmlAddSibling", libxml_xmlAddSibling, METH_VARARGS, NULL }, #if defined(LIBXML_DEBUG_ENABLED) { (char *)"xmlBoolToText", libxml_xmlBoolToText, METH_VARARGS, NULL }, @@ -1662,9 +1662,9 @@ #if defined(LIBXML_VALID_ENABLED) { (char *)"xmlValidateElement", libxml_xmlValidateElement, METH_VARARGS, NULL }, #endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) { (char *)"xmlValidateNCName", libxml_xmlValidateNCName, METH_VARARGS, NULL }, -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) { (char *)"xmlValidateNMToken", libxml_xmlValidateNMToken, METH_VARARGS, NULL }, #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ diff --git a/python/libxml2-py.c b/python/libxml2-py.c index 5d66e54..705c171 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -1132,7 +1132,7 @@ libxml_xmlAddNextSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) PyObject * libxml_xmlAddPrevSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -1152,7 +1152,7 @@ libxml_xmlAddPrevSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ PyObject * libxml_xmlAddSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -2429,12 +2429,12 @@ PyObject * libxml_xmlDocGetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlDocGetRootElement", &pyobj_doc)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlDocGetRootElement(doc); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -2525,13 +2525,13 @@ PyObject * libxml_xmlEncodeSpecialChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * input; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlEncodeSpecialChars(doc, input); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -2836,12 +2836,12 @@ PyObject * libxml_xmlGetDocCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetDocCompressMode", &pyobj_doc)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlGetDocCompressMode(doc); py_retval = libxml_intWrap((int) c_retval); @@ -2852,13 +2852,13 @@ PyObject * libxml_xmlGetDocEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlEntityPtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDocEntity", &pyobj_doc, &name)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlGetDocEntity(doc, name); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -2989,12 +2989,12 @@ PyObject * libxml_xmlGetIntSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlDtdPtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetIntSubset", &pyobj_doc)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlGetIntSubset(doc); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -3005,12 +3005,12 @@ PyObject * libxml_xmlGetLastChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlNodePtr parent; + xmlNode * parent; PyObject *pyobj_parent; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLastChild", &pyobj_parent)) return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); + parent = (xmlNode *) PyxmlNode_Get(pyobj_parent); c_retval = xmlGetLastChild(parent); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -3031,12 +3031,12 @@ PyObject * libxml_xmlGetLineNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; long c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLineNo", &pyobj_node)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlGetLineNo(node); py_retval = libxml_longWrap((long) c_retval); @@ -3047,13 +3047,13 @@ PyObject * libxml_xmlGetNoNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetNoNsProp", &pyobj_node, &name)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlGetNoNsProp(node, name); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -3065,12 +3065,12 @@ PyObject * libxml_xmlGetNodePath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetNodePath", &pyobj_node)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlGetNodePath(node); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -3082,14 +3082,14 @@ PyObject * libxml_xmlGetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; xmlChar * name; xmlChar * nameSpace; if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetNsProp", &pyobj_node, &name, &nameSpace)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlGetNsProp(node, name, nameSpace); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -3131,13 +3131,13 @@ PyObject * libxml_xmlGetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetProp", &pyobj_node, &name)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlGetProp(node, name); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -3167,14 +3167,14 @@ PyObject * libxml_xmlHasNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlAttrPtr c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; xmlChar * name; xmlChar * nameSpace; if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlHasNsProp", &pyobj_node, &name, &nameSpace)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlHasNsProp(node, name, nameSpace); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -3185,13 +3185,13 @@ PyObject * libxml_xmlHasProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlAttrPtr c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlHasProp", &pyobj_node, &name)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlHasProp(node, name); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -3332,12 +3332,12 @@ PyObject * libxml_xmlIsBlankNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlIsBlankNode", &pyobj_node)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlIsBlankNode(node); py_retval = libxml_intWrap((int) c_retval); @@ -4028,13 +4028,13 @@ PyObject * libxml_xmlNewDocText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * content; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocText", &pyobj_doc, &content)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlNewDocText(doc, content); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -4245,13 +4245,13 @@ PyObject * libxml_xmlNewReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewReference", &pyobj_doc, &name)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlNewReference(doc, name); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -4449,15 +4449,15 @@ PyObject * libxml_xmlNodeGetBase(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; - xmlNodePtr cur; + xmlNode * cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"OO:xmlNodeGetBase", &pyobj_doc, &pyobj_cur)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); c_retval = xmlNodeGetBase(doc, cur); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -4468,12 +4468,12 @@ PyObject * libxml_xmlNodeGetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr cur; + xmlNode * cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetContent", &pyobj_cur)) return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); + cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); c_retval = xmlNodeGetContent(cur); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -4484,12 +4484,12 @@ PyObject * libxml_xmlNodeGetLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlNodePtr cur; + xmlNode * cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetLang", &pyobj_cur)) return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); + cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); c_retval = xmlNodeGetLang(cur); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -4500,12 +4500,12 @@ PyObject * libxml_xmlNodeGetSpacePreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; - xmlNodePtr cur; + xmlNode * cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetSpacePreserve", &pyobj_cur)) return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); + cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); c_retval = xmlNodeGetSpacePreserve(cur); py_retval = libxml_intWrap((int) c_retval); @@ -4516,12 +4516,12 @@ PyObject * libxml_xmlNodeIsText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; - xmlNodePtr node; + xmlNode * node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeIsText", &pyobj_node)) return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); + node = (xmlNode *) PyxmlNode_Get(pyobj_node); c_retval = xmlNodeIsText(node); py_retval = libxml_intWrap((int) c_retval); @@ -4533,16 +4533,16 @@ PyObject * libxml_xmlNodeListGetRawString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; - xmlNodePtr list; + xmlNode * list; PyObject *pyobj_list; int inLine; if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetRawString", &pyobj_doc, &pyobj_list, &inLine)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - list = (xmlNodePtr) PyxmlNode_Get(pyobj_list); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + list = (xmlNode *) PyxmlNode_Get(pyobj_list); c_retval = xmlNodeListGetRawString(doc, list, inLine); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -4556,14 +4556,14 @@ libxml_xmlNodeListGetString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xmlChar * c_retval; xmlDocPtr doc; PyObject *pyobj_doc; - xmlNodePtr list; + xmlNode * list; PyObject *pyobj_list; int inLine; if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetString", &pyobj_doc, &pyobj_list, &inLine)) return(NULL); doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - list = (xmlNodePtr) PyxmlNode_Get(pyobj_list); + list = (xmlNode *) PyxmlNode_Get(pyobj_list); c_retval = xmlNodeListGetString(doc, list, inLine); py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); @@ -7517,13 +7517,13 @@ PyObject * libxml_xmlStringGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * value; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlStringGetNodeList", &pyobj_doc, &value)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlStringGetNodeList(doc, value); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -7556,14 +7556,14 @@ PyObject * libxml_xmlStringLenGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNodePtr c_retval; - xmlDocPtr doc; + xmlDoc * doc; PyObject *pyobj_doc; xmlChar * value; int len; if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlStringLenGetNodeList", &pyobj_doc, &value, &len)) return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); c_retval = xmlStringLenGetNodeList(doc, value, len); py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); @@ -12384,7 +12384,7 @@ libxml_xmlValidateElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) PyObject * libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -12400,7 +12400,7 @@ libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) PyObject * libxml_xmlValidateNMToken(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { diff --git a/python/libxml2-py.h b/python/libxml2-py.h index ab57087..9787b0d 100644 --- a/python/libxml2-py.h +++ b/python/libxml2-py.h @@ -166,9 +166,9 @@ PyObject * libxml_xmlAddDocEntity(PyObject *self, PyObject *args); PyObject * libxml_xmlAddDtdEntity(PyObject *self, PyObject *args); PyObject * libxml_xmlAddEncodingAlias(PyObject *self, PyObject *args); PyObject * libxml_xmlAddNextSibling(PyObject *self, PyObject *args); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) PyObject * libxml_xmlAddPrevSibling(PyObject *self, PyObject *args); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ PyObject * libxml_xmlAddSibling(PyObject *self, PyObject *args); #if defined(LIBXML_DEBUG_ENABLED) PyObject * libxml_xmlBoolToText(PyObject *self, PyObject *args); @@ -1662,9 +1662,9 @@ PyObject * libxml_xmlValidateDtdFinal(PyObject *self, PyObject *args); #if defined(LIBXML_VALID_ENABLED) PyObject * libxml_xmlValidateElement(PyObject *self, PyObject *args); #endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) PyObject * libxml_xmlValidateNCName(PyObject *self, PyObject *args); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) PyObject * libxml_xmlValidateNMToken(PyObject *self, PyObject *args); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ diff --git a/python/libxml2.py b/python/libxml2.py index 9712d16..76b8dcd 100644 --- a/python/libxml2.py +++ b/python/libxml2.py @@ -530,7 +530,7 @@ class xmlCoreDepthFirstItertor: self.parents = [] def __iter__(self): return self - def next(self): + def __next__(self): while 1: if self.node: ret = self.node @@ -542,6 +542,7 @@ class xmlCoreDepthFirstItertor: except IndexError: raise StopIteration self.node = parent.next + next = __next__ # # implements the breadth-first iterator for libxml2 DOM tree @@ -552,7 +553,7 @@ class xmlCoreBreadthFirstItertor: self.parents = [] def __iter__(self): return self - def next(self): + def __next__(self): while 1: if self.node: ret = self.node @@ -564,6 +565,7 @@ class xmlCoreBreadthFirstItertor: except IndexError: raise StopIteration self.node = parent.children + next = __next__ # # converters to present a nicer view of the XPath returns @@ -3363,8 +3365,10 @@ class xmlNode(xmlCore): def newNs(self, href, prefix): """Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing - one present on this node. We use href==None in the case of - an element creation where the namespace was not defined. """ + one present on this node. Note that for a default + namespace, @prefix should be None. We use href==None in + the case of an element creation where the namespace was not + defined. """ ret = libxml2mod.xmlNewNs(self._o, href, prefix) if ret is None:raise treeError('xmlNewNs() failed') __tmp = xmlNs(_obj=ret) diff --git a/python/libxml2class.py b/python/libxml2class.py index 48aa7ba..4b718dc 100644 --- a/python/libxml2class.py +++ b/python/libxml2class.py @@ -2577,8 +2577,10 @@ class xmlNode(xmlCore): def newNs(self, href, prefix): """Creation of a new Namespace. This function will refuse to create a namespace with a similar prefix than an existing - one present on this node. We use href==None in the case of - an element creation where the namespace was not defined. """ + one present on this node. Note that for a default + namespace, @prefix should be None. We use href==None in + the case of an element creation where the namespace was not + defined. """ ret = libxml2mod.xmlNewNs(self._o, href, prefix) if ret is None:raise treeError('xmlNewNs() failed') __tmp = xmlNs(_obj=ret) diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h index a9b9739..53a0618 100644 --- a/python/libxml_wrap.h +++ b/python/libxml_wrap.h @@ -34,11 +34,11 @@ #define PyBytes_AsString PyString_AsString #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE - +#endif +#ifndef PyCapsule_New #define PyCapsule_New PyCObject_FromVoidPtrAndDesc #define PyCapsule_CheckExact PyCObject_Check #define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o)) - #endif #endif diff --git a/python/setup.py b/python/setup.py index f24674c..e504323 100755 --- a/python/setup.py +++ b/python/setup.py @@ -6,14 +6,14 @@ import sys, os from distutils.core import setup, Extension # Below ROOT, we expect to find include, include/libxml2, lib and bin. -# On *nix, it is not needed (but should not harm), +# On *nix, it is not needed (but should not harm), # on Windows, it is set by configure.js. -ROOT = r'/usr' +ROOT = r'/usr' # Thread-enabled libxml2 with_threads = 1 -# If this flag is set (windows only), +# If this flag is set (windows only), # a private copy of the dlls are included in the package. # If this flag is not set, the libxml2 and libxslt # dlls must be found somewhere in the PATH at runtime. @@ -51,9 +51,9 @@ else: libraryPrefix = '' platformLibs = ["m","z"] -# those are examined to find +# those are examined to find # - libxml2/libxml/tree.h -# - iconv.h +# - iconv.h # - libxslt/xsltconfig.h includes_dir = [ "/usr/include", @@ -67,7 +67,7 @@ xml_includes="" for dir in includes_dir: if not missing(dir + "/libxml2/libxml/tree.h"): xml_includes=dir + "/libxml2" - break; + break; if xml_includes == "": print("failed to find headers for libxml2: update includes_dir") @@ -77,7 +77,7 @@ iconv_includes="" for dir in includes_dir: if not missing(dir + "/iconv.h"): iconv_includes=dir - break; + break; if iconv_includes == "": print("failed to find headers for libiconv: update includes_dir") @@ -90,22 +90,22 @@ os.path.join(ROOT,'lib'), xml_files = ["libxml2-api.xml", "libxml2-python-api.xml", "libxml.c", "libxml.py", "libxml_wrap.h", "types.c", - "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] + "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml", "libxslt.c", "libxsl.py", "libxslt_wrap.h", - "xsltgenerator.py"] + "xsltgenerator.py"] if missing("libxml2-py.c") or missing("libxml2.py"): try: - try: - import xmlgenerator - except: - import generator + try: + import xmlgenerator + except: + import generator except: - print("failed to find and generate stubs for libxml2, aborting ...") - print(sys.exc_info()[0], sys.exc_info()[1]) - sys.exit(1) + print("failed to find and generate stubs for libxml2, aborting ...") + print(sys.exc_info()[0], sys.exc_info()[1]) + sys.exit(1) head = open("libxml.py", "r") generated = open("libxml2class.py", "r") @@ -116,7 +116,7 @@ if missing("libxml2-py.c") or missing("libxml2.py"): else: result.write(line) for line in generated.readlines(): - result.write(line) + result.write(line) head.close() generated.close() result.close() @@ -126,39 +126,39 @@ if missing("libxslt-py.c") or missing("libxslt.py"): if missing("xsltgenerator.py") or missing("libxslt-api.xml"): print("libxslt stub generator not found, libxslt not built") else: - try: - import xsltgenerator - except: - print("failed to generate stubs for libxslt, aborting ...") - print(sys.exc_info()[0], sys.exc_info()[1]) - else: - head = open("libxsl.py", "r") - generated = open("libxsltclass.py", "r") - result = open("libxslt.py", "w") - for line in head.readlines(): + try: + import xsltgenerator + except: + print("failed to generate stubs for libxslt, aborting ...") + print(sys.exc_info()[0], sys.exc_info()[1]) + else: + head = open("libxsl.py", "r") + generated = open("libxsltclass.py", "r") + result = open("libxslt.py", "w") + for line in head.readlines(): if WITHDLLS: result.write(altImport(line)) else: result.write(line) - for line in generated.readlines(): - result.write(line) - head.close() - generated.close() - result.close() - with_xslt=1 + for line in generated.readlines(): + result.write(line) + head.close() + generated.close() + result.close() + with_xslt=1 else: with_xslt=1 if with_xslt == 1: xslt_includes="" for dir in includes_dir: - if not missing(dir + "/libxslt/xsltconfig.h"): - xslt_includes=dir + "/libxslt" - break; + if not missing(dir + "/libxslt/xsltconfig.h"): + xslt_includes=dir + "/libxslt" + break; if xslt_includes == "": - print("failed to find headers for libxslt: update includes_dir") - with_xslt = 0 + print("failed to find headers for libxslt: update includes_dir") + with_xslt = 0 descr = "libxml2 package" @@ -194,11 +194,11 @@ if with_xslt == 1: extens=[Extension('libxml2mod', c_files, include_dirs=includes, - library_dirs=libdirs, - libraries=libs, define_macros=macros)] + library_dirs=libdirs, + libraries=libs, define_macros=macros)] if with_xslt == 1: extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes, - library_dirs=libdirs, + library_dirs=libdirs, libraries=libs, define_macros=macros)) if missing("MANIFEST"): @@ -208,8 +208,8 @@ if missing("MANIFEST"): for file in xml_files: manifest.write(file + "\n") if with_xslt == 1: - for file in xslt_files: - manifest.write(file + "\n") + for file in xslt_files: + manifest.write(file + "\n") manifest.close() if WITHDLLS: @@ -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.9.1", + version = "2.9.2", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/setup.py.in b/python/setup.py.in index 0e72338..90c2114 100755 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -6,14 +6,14 @@ import sys, os from distutils.core import setup, Extension # Below ROOT, we expect to find include, include/libxml2, lib and bin. -# On *nix, it is not needed (but should not harm), +# On *nix, it is not needed (but should not harm), # on Windows, it is set by configure.js. -ROOT = r'@prefix@' +ROOT = r'@prefix@' # Thread-enabled libxml2 with_threads = @WITH_THREADS@ -# If this flag is set (windows only), +# If this flag is set (windows only), # a private copy of the dlls are included in the package. # If this flag is not set, the libxml2 and libxslt # dlls must be found somewhere in the PATH at runtime. @@ -51,9 +51,9 @@ else: libraryPrefix = '' platformLibs = ["m","z"] -# those are examined to find +# those are examined to find # - libxml2/libxml/tree.h -# - iconv.h +# - iconv.h # - libxslt/xsltconfig.h includes_dir = [ "/usr/include", @@ -67,7 +67,7 @@ xml_includes="" for dir in includes_dir: if not missing(dir + "/libxml2/libxml/tree.h"): xml_includes=dir + "/libxml2" - break; + break; if xml_includes == "": print("failed to find headers for libxml2: update includes_dir") @@ -77,7 +77,7 @@ iconv_includes="" for dir in includes_dir: if not missing(dir + "/iconv.h"): iconv_includes=dir - break; + break; if iconv_includes == "": print("failed to find headers for libiconv: update includes_dir") @@ -90,22 +90,22 @@ os.path.join(ROOT,'lib'), xml_files = ["libxml2-api.xml", "libxml2-python-api.xml", "libxml.c", "libxml.py", "libxml_wrap.h", "types.c", - "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] + "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml", "libxslt.c", "libxsl.py", "libxslt_wrap.h", - "xsltgenerator.py"] + "xsltgenerator.py"] if missing("libxml2-py.c") or missing("libxml2.py"): try: - try: - import xmlgenerator - except: - import generator + try: + import xmlgenerator + except: + import generator except: - print("failed to find and generate stubs for libxml2, aborting ...") - print(sys.exc_info()[0], sys.exc_info()[1]) - sys.exit(1) + print("failed to find and generate stubs for libxml2, aborting ...") + print(sys.exc_info()[0], sys.exc_info()[1]) + sys.exit(1) head = open("libxml.py", "r") generated = open("libxml2class.py", "r") @@ -116,7 +116,7 @@ if missing("libxml2-py.c") or missing("libxml2.py"): else: result.write(line) for line in generated.readlines(): - result.write(line) + result.write(line) head.close() generated.close() result.close() @@ -126,39 +126,39 @@ if missing("libxslt-py.c") or missing("libxslt.py"): if missing("xsltgenerator.py") or missing("libxslt-api.xml"): print("libxslt stub generator not found, libxslt not built") else: - try: - import xsltgenerator - except: - print("failed to generate stubs for libxslt, aborting ...") - print(sys.exc_info()[0], sys.exc_info()[1]) - else: - head = open("libxsl.py", "r") - generated = open("libxsltclass.py", "r") - result = open("libxslt.py", "w") - for line in head.readlines(): + try: + import xsltgenerator + except: + print("failed to generate stubs for libxslt, aborting ...") + print(sys.exc_info()[0], sys.exc_info()[1]) + else: + head = open("libxsl.py", "r") + generated = open("libxsltclass.py", "r") + result = open("libxslt.py", "w") + for line in head.readlines(): if WITHDLLS: result.write(altImport(line)) else: result.write(line) - for line in generated.readlines(): - result.write(line) - head.close() - generated.close() - result.close() - with_xslt=1 + for line in generated.readlines(): + result.write(line) + head.close() + generated.close() + result.close() + with_xslt=1 else: with_xslt=1 if with_xslt == 1: xslt_includes="" for dir in includes_dir: - if not missing(dir + "/libxslt/xsltconfig.h"): - xslt_includes=dir + "/libxslt" - break; + if not missing(dir + "/libxslt/xsltconfig.h"): + xslt_includes=dir + "/libxslt" + break; if xslt_includes == "": - print("failed to find headers for libxslt: update includes_dir") - with_xslt = 0 + print("failed to find headers for libxslt: update includes_dir") + with_xslt = 0 descr = "libxml2 package" @@ -194,11 +194,11 @@ if with_xslt == 1: extens=[Extension('libxml2mod', c_files, include_dirs=includes, - library_dirs=libdirs, - libraries=libs, define_macros=macros)] + library_dirs=libdirs, + libraries=libs, define_macros=macros)] if with_xslt == 1: extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes, - library_dirs=libdirs, + library_dirs=libdirs, libraries=libs, define_macros=macros)) if missing("MANIFEST"): @@ -208,8 +208,8 @@ if missing("MANIFEST"): for file in xml_files: manifest.write(file + "\n") if with_xslt == 1: - for file in xslt_files: - manifest.write(file + "\n") + for file in xslt_files: + manifest.write(file + "\n") manifest.close() if WITHDLLS: diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index 132538f..ffda69b 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,23 +15,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -52,25 +79,31 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python/tests -DIST_COMMON = $(dist_example_DATA) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(dist_example_DATA) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -107,6 +140,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(exampledir)" DATA = $(dist_example_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -193,6 +227,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_LIBS = @PYTHON_LIBS@ @@ -452,11 +489,11 @@ uninstall-dist_exampleDATA: @list='$(dist_example_DATA)'; test -n "$(exampledir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(exampledir)'; $(am__uninstall_files_from_dir) -tags: TAGS -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -596,16 +633,17 @@ uninstall-am: uninstall-dist_exampleDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dist_exampleDATA \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-dist_exampleDATA + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_exampleDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-dist_exampleDATA @WITH_PYTHON_TRUE@tests: $(PYTESTS) diff --git a/python/tests/sync.py b/python/tests/sync.py index 9d565db..5a8609e 100755 --- a/python/tests/sync.py +++ b/python/tests/sync.py @@ -51,7 +51,7 @@ ctxt=None reference = "startDocument:startElement foo None:startElement bar2 None:endElement bar2:" if log != reference: print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -63,7 +63,7 @@ ctxt=None reference = "startDocument:startElement foo None:startElement bar2 None:endElement bar2:" if log != reference: print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -75,7 +75,7 @@ ctxt=None reference = "startDocument:startElement foo None:startElement bar2 None:" if log != reference: print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -84,10 +84,11 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" -if log != reference: +reference1 = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" +reference2 = "startDocument:startElement foo None:startElement bar2 {'b': '2', 'a': '1'}:endElement bar2:" +if log not in (reference1, reference2): print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -96,10 +97,11 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:" -if log != reference: +reference1 = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:" +reference2 = "startDocument:startElement foo None:startElement bar2 {'b': '2', 'a': '1'}:" +if log not in (reference1, reference2): print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -108,10 +110,11 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" -if log != reference: +reference1 = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" +reference2 = "startDocument:startElement foo None:startElement bar2 {'b': '2', 'a': '1'}:endElement bar2:" +if log not in (reference1, reference2): print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) log="" @@ -123,7 +126,7 @@ ctxt=None reference = "startDocument:startElement foo None:" if log != reference: print("Error got: %s" % log) - print("Exprected: %s" % reference) + print("Expected: %s" % reference) sys.exit(1) # Memory debug specific diff --git a/python/types.c b/python/types.c index 31c909a..f237677 100644 --- a/python/types.c +++ b/python/types.c @@ -594,7 +594,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj) } xmlXPathObjectPtr -libxml_xmlXPathObjectPtrConvert(PyObject * obj) +libxml_xmlXPathObjectPtrConvert(PyObject *obj) { xmlXPathObjectPtr ret = NULL; @@ -633,11 +633,11 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) #if PY_VERSION_HEX >= 0x03030000 xmlChar *str; const char *tmp; - size_t size; + Py_ssize_t size; /* tmp doesn't need to be deallocated */ tmp = PyUnicode_AsUTF8AndSize(obj, &size); - str = xmlStrndup(tmp, (int) size); + str = xmlStrndup((const xmlChar *) tmp, (int) size); ret = xmlXPathWrapString(str); #else xmlChar *str = NULL; -- cgit v1.2.3