diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/Makefile.in | 292 | ||||
-rw-r--r-- | python/drv_libxml2.py | 18 | ||||
-rwxr-xr-x | python/generator.py | 2 | ||||
-rw-r--r-- | python/libxml.c | 5 | ||||
-rw-r--r-- | python/libxml.py | 6 | ||||
-rw-r--r-- | python/libxml2-export.c | 8 | ||||
-rw-r--r-- | python/libxml2-py.c | 116 | ||||
-rw-r--r-- | python/libxml2-py.h | 8 | ||||
-rw-r--r-- | python/libxml2.py | 12 | ||||
-rw-r--r-- | python/libxml2class.py | 6 | ||||
-rw-r--r-- | python/libxml_wrap.h | 4 | ||||
-rwxr-xr-x | python/setup.py | 88 | ||||
-rwxr-xr-x | python/setup.py.in | 86 | ||||
-rw-r--r-- | python/tests/Makefile.in | 110 | ||||
-rwxr-xr-x | python/tests/sync.py | 29 | ||||
-rw-r--r-- | python/types.c | 6 |
16 files changed, 357 insertions, 439 deletions
diff --git a/python/Makefile.in b/python/Makefile.in index 03fbd5b..efdea43 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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,51 +17,23 @@ VPATH = @srcdir@ -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 \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - 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;; \ + 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;; \ 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)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -80,14 +53,14 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python -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 +DIST_COMMON = README $(am__dist_python_DATA_DIST) $(dist_docs_DATA) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/setup.py.in 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.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -133,23 +106,10 @@ 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 @@ -162,26 +122,29 @@ 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_CC_1 = +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 = @ 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_CCLD_1 = +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 " $@; SOURCES = $(libxml2mod_la_SOURCES) DIST_SOURCES = $(am__libxml2mod_la_SOURCES_DIST) -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 +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 am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -191,29 +154,9 @@ 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_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags 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) @@ -328,9 +271,6 @@ 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@ @@ -543,7 +483,6 @@ $(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=; \ @@ -570,15 +509,12 @@ uninstall-pythonLTLIBRARIES: clean-pythonLTLIBRARIES: -test -z "$(python_LTLIBRARIES)" || rm -f $(python_LTLIBRARIES) - @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}; \ - } - + @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 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) @@ -662,25 +598,22 @@ 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. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# 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; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -695,12 +628,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(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 -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +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) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -716,7 +694,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_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; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -728,11 +711,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +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; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -741,21 +728,6 @@ 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 @@ -931,12 +903,13 @@ ps-am: uninstall-am: uninstall-dist_docsDATA uninstall-dist_pythonDATA \ uninstall-pythonLTLIBRARIES -.MAKE: $(am__recursive_targets) all check install install-am \ - install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + ctags-recursive install install-am install-strip \ + tags-recursive -.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 \ +.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 \ 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 \ @@ -948,8 +921,9 @@ 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-am uninstall uninstall-am uninstall-dist_docsDATA \ - uninstall-dist_pythonDATA uninstall-pythonLTLIBRARIES + tags tags-recursive 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 c2ec3e2..e43fb1d 100644 --- a/python/drv_libxml2.py +++ b/python/drv_libxml2.py @@ -34,18 +34,12 @@ TODO """ -__author__ = "Stéphane Bidoul <sbi@skynet.be>" +__author__ = u"Stéphane Bidoul <sbi@skynet.be>" __version__ = "0.3" -import sys import codecs - -if sys.version_info[0] < 3: - __author__ = codecs.unicode_escape_decode(__author__)[0] - - StringTypes = (str, unicode) -else: - StringTypes = str +from types import StringType, UnicodeType +StringTypes = (StringType,UnicodeType) from xml.sax._exceptions import * from xml.sax import xmlreader, saxutils @@ -71,9 +65,9 @@ def _d(s): try: import libxml2 -except ImportError: +except ImportError, e: raise SAXReaderNotAvailable("libxml2 not available: " \ - "import error was: %s" % sys.exc_info()[1]) + "import error was: %s" % e) class Locator(xmlreader.Locator): """SAX Locator adapter for libxml2.xmlTextReaderLocator""" @@ -140,7 +134,7 @@ class LibXml2Reader(xmlreader.XMLReader): self.__parsing = 1 try: # prepare source and create reader - if isinstance(source, StringTypes): + if type(source) in StringTypes: reader = libxml2.newTextReaderFilename(source) else: source = saxutils.prepare_input_source(source) diff --git a/python/generator.py b/python/generator.py index c0cb3ad..82109e3 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"), - "xmlDoc *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"), + "xmlDocPtr *": ("._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 30b71f3..03cfb9f 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 - Py_ssize_t size; + size_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 - Py_ssize_t size; + size_t size; const char *tmp; /* tmp doesn't need to be deallocated */ @@ -2683,7 +2683,6 @@ 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 2466cc9..e507e0f 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,7 +542,6 @@ class xmlCoreDepthFirstItertor: except IndexError: raise StopIteration self.node = parent.next - next = __next__ # # implements the breadth-first iterator for libxml2 DOM tree @@ -553,7 +552,7 @@ class xmlCoreBreadthFirstItertor: self.parents = [] def __iter__(self): return self - def __next__(self): + def next(self): while 1: if self.node: ret = self.node @@ -565,7 +564,6 @@ 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 84073ea..f7d96e1 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) || defined(LIBXML_XINCLUDE_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) { (char *)"xmlAddPrevSibling", libxml_xmlAddPrevSibling, METH_VARARGS, NULL }, -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_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) || defined(LIBXML_LEGACY_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) { (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) || defined(LIBXML_LEGACY_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) */ #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 705c171..5d66e54 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) || defined(LIBXML_XINCLUDE_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_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) || defined(LIBXML_XINCLUDE_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlDocGetRootElement", &pyobj_doc)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * input; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetDocCompressMode", &pyobj_doc)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDocEntity", &pyobj_doc, &name)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetIntSubset", &pyobj_doc)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlNode * parent; + xmlNodePtr parent; PyObject *pyobj_parent; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLastChild", &pyobj_parent)) return(NULL); - parent = (xmlNode *) PyxmlNode_Get(pyobj_parent); + parent = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLineNo", &pyobj_node)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetNoNsProp", &pyobj_node, &name)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlGetNodePath", &pyobj_node)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; xmlChar * name; xmlChar * nameSpace; if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetNsProp", &pyobj_node, &name, &nameSpace)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetProp", &pyobj_node, &name)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; xmlChar * name; xmlChar * nameSpace; if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlHasNsProp", &pyobj_node, &name, &nameSpace)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlHasProp", &pyobj_node, &name)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlIsBlankNode", &pyobj_node)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * content; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocText", &pyobj_doc, &content)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * name; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewReference", &pyobj_doc, &name)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; - xmlNode * cur; + xmlNodePtr cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"OO:xmlNodeGetBase", &pyobj_doc, &pyobj_cur)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); - cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + cur = (xmlNodePtr) 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; - xmlNode * cur; + xmlNodePtr cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetContent", &pyobj_cur)) return(NULL); - cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); + cur = (xmlNodePtr) 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; - xmlNode * cur; + xmlNodePtr cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetLang", &pyobj_cur)) return(NULL); - cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); + cur = (xmlNodePtr) 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; - xmlNode * cur; + xmlNodePtr cur; PyObject *pyobj_cur; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetSpacePreserve", &pyobj_cur)) return(NULL); - cur = (xmlNode *) PyxmlNode_Get(pyobj_cur); + cur = (xmlNodePtr) 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; - xmlNode * node; + xmlNodePtr node; PyObject *pyobj_node; if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeIsText", &pyobj_node)) return(NULL); - node = (xmlNode *) PyxmlNode_Get(pyobj_node); + node = (xmlNodePtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; - xmlNode * list; + xmlNodePtr list; PyObject *pyobj_list; int inLine; if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetRawString", &pyobj_doc, &pyobj_list, &inLine)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); - list = (xmlNode *) PyxmlNode_Get(pyobj_list); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + list = (xmlNodePtr) 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; - xmlNode * list; + xmlNodePtr 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 = (xmlNode *) PyxmlNode_Get(pyobj_list); + list = (xmlNodePtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * value; if (!PyArg_ParseTuple(args, (char *)"Oz:xmlStringGetNodeList", &pyobj_doc, &value)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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; - xmlDoc * doc; + xmlDocPtr doc; PyObject *pyobj_doc; xmlChar * value; int len; if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlStringLenGetNodeList", &pyobj_doc, &value, &len)) return(NULL); - doc = (xmlDoc *) PyxmlNode_Get(pyobj_doc); + doc = (xmlDocPtr) 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) || defined(LIBXML_LEGACY_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) 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) || defined(LIBXML_LEGACY_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) */ #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 9787b0d..ab57087 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) || defined(LIBXML_XINCLUDE_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) PyObject * libxml_xmlAddPrevSibling(PyObject *self, PyObject *args); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_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) || defined(LIBXML_LEGACY_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) 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) || defined(LIBXML_LEGACY_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) */ #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 76b8dcd..9712d16 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,7 +542,6 @@ class xmlCoreDepthFirstItertor: except IndexError: raise StopIteration self.node = parent.next - next = __next__ # # implements the breadth-first iterator for libxml2 DOM tree @@ -553,7 +552,7 @@ class xmlCoreBreadthFirstItertor: self.parents = [] def __iter__(self): return self - def __next__(self): + def next(self): while 1: if self.node: ret = self.node @@ -565,7 +564,6 @@ class xmlCoreBreadthFirstItertor: except IndexError: raise StopIteration self.node = parent.children - next = __next__ # # converters to present a nicer view of the XPath returns @@ -3365,10 +3363,8 @@ 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. 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. """ + one present on this node. 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 4b718dc..48aa7ba 100644 --- a/python/libxml2class.py +++ b/python/libxml2class.py @@ -2577,10 +2577,8 @@ 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. 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. """ + one present on this node. 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 53a0618..a9b9739 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 e504323..f24674c 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.2", + version = "2.9.1", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/setup.py.in b/python/setup.py.in index 90c2114..0e72338 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 ffda69b..132538f 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @@ -15,51 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ -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 \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - 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;; \ + 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;; \ 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)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -79,31 +52,25 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python/tests -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(dist_example_DATA) +DIST_COMMON = $(dist_example_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in 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.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in 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_1 = +am__v_GEN_0 = @echo " GEN " $@; 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 = \ @@ -140,7 +107,6 @@ 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@ @@ -227,9 +193,6 @@ 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@ @@ -489,11 +452,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: - -ctags CTAGS: +tags: TAGS +TAGS: -cscope cscopelist: +ctags: CTAGS +CTAGS: distdir: $(DISTFILES) @@ -633,17 +596,16 @@ uninstall-am: uninstall-dist_exampleDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - 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 + 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 @WITH_PYTHON_TRUE@tests: $(PYTESTS) diff --git a/python/tests/sync.py b/python/tests/sync.py index 5a8609e..9d565db 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("Expected: %s" % reference) + print("Exprected: %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("Expected: %s" % reference) + print("Exprected: %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("Expected: %s" % reference) + print("Exprected: %s" % reference) sys.exit(1) log="" @@ -84,11 +84,10 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -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): +reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" +if log != reference: print("Error got: %s" % log) - print("Expected: %s" % reference) + print("Exprected: %s" % reference) sys.exit(1) log="" @@ -97,11 +96,10 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -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): +reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:" +if log != reference: print("Error got: %s" % log) - print("Expected: %s" % reference) + print("Exprected: %s" % reference) sys.exit(1) log="" @@ -110,11 +108,10 @@ ctxt = libxml2.createPushParser(handler, None, 0, "test.xml") ctxt.parseChunk(chunk, len(chunk), 0) ctxt=None -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): +reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:" +if log != reference: print("Error got: %s" % log) - print("Expected: %s" % reference) + print("Exprected: %s" % reference) sys.exit(1) log="" @@ -126,7 +123,7 @@ ctxt=None reference = "startDocument:startElement foo None:" if log != reference: print("Error got: %s" % log) - print("Expected: %s" % reference) + print("Exprected: %s" % reference) sys.exit(1) # Memory debug specific diff --git a/python/types.c b/python/types.c index f237677..31c909a 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; - Py_ssize_t size; + size_t size; /* tmp doesn't need to be deallocated */ tmp = PyUnicode_AsUTF8AndSize(obj, &size); - str = xmlStrndup((const xmlChar *) tmp, (int) size); + str = xmlStrndup(tmp, (int) size); ret = xmlXPathWrapString(str); #else xmlChar *str = NULL; |