Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-yq for openSUSE:Factory checked in at 2023-05-15 16:54:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-yq (Old) and /work/SRC/openSUSE:Factory/.python-yq.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-yq" Mon May 15 16:54:27 2023 rev:13 rq:1087126 version:3.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-yq/python-yq.changes 2023-04-07 18:17:09.492832950 +0200 +++ /work/SRC/openSUSE:Factory/.python-yq.new.1533/python-yq.changes 2023-05-15 16:54:40.872292563 +0200 @@ -1,0 +2,6 @@ +Sun May 14 18:48:00 UTC 2023 - Dirk Müller <[email protected]> + +- update to 3.2.2: + * Allow XML documents to be streamed with âxml-item-depth + +------------------------------------------------------------------- Old: ---- yq-3.2.1.tar.gz New: ---- yq-3.2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-yq.spec ++++++ --- /var/tmp/diff_new_pack.GWDTdE/_old 2023-05-15 16:54:41.300294926 +0200 +++ /var/tmp/diff_new_pack.GWDTdE/_new 2023-05-15 16:54:41.308294970 +0200 @@ -18,7 +18,7 @@ %define skip_python2 1 Name: python-yq -Version: 3.2.1 +Version: 3.2.2 Release: 0 Summary: Command-line YAML processor - jq wrapper for YAML documents License: Apache-2.0 ++++++ yq-3.2.1.tar.gz -> yq-3.2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/Changes.rst new/yq-3.2.2/Changes.rst --- old/yq-3.2.1/Changes.rst 2023-04-05 03:36:26.000000000 +0200 +++ new/yq-3.2.2/Changes.rst 2023-04-22 23:42:12.000000000 +0200 @@ -1,3 +1,8 @@ +Changes for v3.2.2 (2023-04-22) +=============================== + +- Allow XML documents to be streamed with âxml-item-depth + Changes for v3.2.1 (2023-04-04) =============================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/PKG-INFO new/yq-3.2.2/PKG-INFO --- old/yq-3.2.1/PKG-INFO 2023-04-05 03:36:45.064249300 +0200 +++ new/yq-3.2.2/PKG-INFO 2023-04-22 23:42:29.521048000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: yq -Version: 3.2.1 +Version: 3.2.2 Summary: Command-line YAML/XML processor - jq wrapper for YAML/XML documents Home-page: https://github.com/kislyuk/yq Author: Andrey Kislyuk @@ -132,7 +132,10 @@ `transcodes XML to JSON <https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html>`_ using `xmltodict <https://github.com/martinblech/xmltodict>`_ and pipes it to ``jq``. Roundtrip transcoding is available with the ``xq --xml-output``/``xq -x`` option. Multiple XML documents can be passed in separate files/streams as -``xq a.xml b.xml``. Entity expansion and DTD resolution is disabled to avoid XML parsing vulnerabilities. +``xq a.xml b.xml``. Use ``--xml-item-depth`` to descend into large documents, streaming their contents without loading +the full doc into memory (for example, stream a `Wikipedia database dump <https://dumps.wikimedia.org>`_ with +``cat enwiki-*.xml.bz2 | bunzip2 | xq . --xml-item-depth=2``). Entity expansion and DTD resolution is disabled to avoid +XML parsing vulnerabilities. TOML support ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/README.rst new/yq-3.2.2/README.rst --- old/yq-3.2.1/README.rst 2023-04-05 03:34:39.000000000 +0200 +++ new/yq-3.2.2/README.rst 2023-04-22 23:40:20.000000000 +0200 @@ -108,7 +108,10 @@ `transcodes XML to JSON <https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html>`_ using `xmltodict <https://github.com/martinblech/xmltodict>`_ and pipes it to ``jq``. Roundtrip transcoding is available with the ``xq --xml-output``/``xq -x`` option. Multiple XML documents can be passed in separate files/streams as -``xq a.xml b.xml``. Entity expansion and DTD resolution is disabled to avoid XML parsing vulnerabilities. +``xq a.xml b.xml``. Use ``--xml-item-depth`` to descend into large documents, streaming their contents without loading +the full doc into memory (for example, stream a `Wikipedia database dump <https://dumps.wikimedia.org>`_ with +``cat enwiki-*.xml.bz2 | bunzip2 | xq . --xml-item-depth=2``). Entity expansion and DTD resolution is disabled to avoid +XML parsing vulnerabilities. TOML support ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/setup.py new/yq-3.2.2/setup.py --- old/yq-3.2.1/setup.py 2023-04-05 03:36:13.000000000 +0200 +++ new/yq-3.2.2/setup.py 2023-04-22 23:41:39.000000000 +0200 @@ -4,7 +4,7 @@ setup( name="yq", - version="3.2.1", + version="3.2.2", url="https://github.com/kislyuk/yq", license="Apache Software License", author="Andrey Kislyuk", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/yq/__init__.py new/yq-3.2.2/yq/__init__.py --- old/yq-3.2.1/yq/__init__.py 2023-04-05 03:34:39.000000000 +0200 +++ new/yq-3.2.2/yq/__init__.py 2023-04-22 23:33:06.000000000 +0200 @@ -183,6 +183,7 @@ width=None, indentless_lists=False, xml_root=None, + xml_item_depth=0, xml_dtd=False, xml_force_list=frozenset(), explicit_start=False, @@ -242,7 +243,14 @@ elif input_format == "xml": import xmltodict - doc = xmltodict.parse(input_stream.read(), disable_entities=True, force_list=xml_force_list) + if xml_item_depth != 0: + raise Exception("xml_item_depth is not supported with xq -x") + + doc = xmltodict.parse( + input_stream.buffer if isinstance(input_stream, io.TextIOWrapper) else input_stream.read(), + disable_entities=True, + force_list=xml_force_list, + ) json.dump(doc, json_buffer, cls=JSONDateTimeEncoder) json_buffer.write("\n") elif input_format == "toml": @@ -320,12 +328,21 @@ elif input_format == "xml": import xmltodict + def emit_entry(path, entry): + json.dump(entry, jq.stdin) # type: ignore + jq.stdin.write("\n") # type: ignore + return True + for input_stream in input_streams: - json.dump( - xmltodict.parse(input_stream.read(), disable_entities=True, force_list=xml_force_list), - jq.stdin, # type: ignore + doc = xmltodict.parse( + input_stream.buffer if isinstance(input_stream, io.TextIOWrapper) else input_stream.read(), + disable_entities=True, + force_list=xml_force_list, + item_depth=xml_item_depth, + item_callback=emit_entry, ) - jq.stdin.write("\n") # type: ignore + if doc: + emit_entry(None, doc) elif input_format == "toml": import tomlkit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/yq/parser.py new/yq-3.2.2/yq/parser.py --- old/yq-3.2.1/yq/parser.py 2023-02-22 06:14:38.000000000 +0100 +++ new/yq-3.2.2/yq/parser.py 2023-04-22 23:07:10.000000000 +0200 @@ -38,7 +38,7 @@ def get_parser(program_name, description): # By default suppress these help strings and only enable them in the specific programs. yaml_output_help, yaml_roundtrip_help, width_help, indentless_help, grammar_help = [argparse.SUPPRESS] * 5 - xml_output_help, xml_dtd_help, xml_root_help, xml_force_list_help = [argparse.SUPPRESS] * 4 + xml_output_help, xml_item_depth_help, xml_dtd_help, xml_root_help, xml_force_list_help = [argparse.SUPPRESS] * 5 toml_output_help = argparse.SUPPRESS if program_name == "yq": @@ -51,7 +51,7 @@ "is incompatible with jq filters that do not expect these extra items." ) width_help = "When using --yaml-output, specify string wrap width" - indentless_help = "When using --yaml-output, indent block style lists (sequences) " "with 0 spaces instead of 2" + indentless_help = "When using --yaml-output, indent block style lists (sequences) with 0 spaces instead of 2" grammar_help = ( "When using --yaml-output, specify output grammar (the default is 1.1 and will be changed " "to 1.2 in a future version). Setting this to 1.2 will cause strings like 'on' and 'no' to be " @@ -60,11 +60,10 @@ elif program_name == "xq": current_language = "XML" xml_output_help = "Transcode jq JSON output back into XML and emit it" + xml_item_depth_help = "Specify depth of items to emit (default 0; use a positive integer to stream large docs)" xml_dtd_help = "Preserve XML Document Type Definition (disables streaming of multiple docs)" xml_root_help = "When transcoding back to XML, envelope the output in an element with this name" - xml_force_list_help = ( - "Tag name to pass to force_list parameter of xmltodict.parse(). " "Can be used multiple times." - ) + xml_force_list_help = "Emit a list for elements with this name even if they occur only once (option can repeat)" elif program_name == "tomlq": current_language = "TOML" toml_output_help = "Transcode jq JSON output back into TOML and emit it" @@ -107,6 +106,7 @@ parser.add_argument( "--xml-output", "-x", dest="output_format", action="store_const", const="xml", help=xml_output_help ) + parser.add_argument("--xml-item-depth", type=int, default=0, help=xml_item_depth_help) parser.add_argument("--xml-dtd", action="store_true", help=xml_dtd_help) parser.add_argument("--xml-root", help=xml_root_help) parser.add_argument("--xml-force-list", action="append", help=xml_force_list_help) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/yq/version.py new/yq-3.2.2/yq/version.py --- old/yq-3.2.1/yq/version.py 2023-04-05 03:36:45.000000000 +0200 +++ new/yq-3.2.2/yq/version.py 2023-04-22 23:42:29.000000000 +0200 @@ -1,4 +1,4 @@ # file generated by setuptools_scm # don't change, don't track in version control -__version__ = version = '3.2.1' -__version_tuple__ = version_tuple = (3, 2, 1) +__version__ = version = '3.2.2' +__version_tuple__ = version_tuple = (3, 2, 2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yq-3.2.1/yq.egg-info/PKG-INFO new/yq-3.2.2/yq.egg-info/PKG-INFO --- old/yq-3.2.1/yq.egg-info/PKG-INFO 2023-04-05 03:36:45.000000000 +0200 +++ new/yq-3.2.2/yq.egg-info/PKG-INFO 2023-04-22 23:42:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: yq -Version: 3.2.1 +Version: 3.2.2 Summary: Command-line YAML/XML processor - jq wrapper for YAML/XML documents Home-page: https://github.com/kislyuk/yq Author: Andrey Kislyuk @@ -132,7 +132,10 @@ `transcodes XML to JSON <https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html>`_ using `xmltodict <https://github.com/martinblech/xmltodict>`_ and pipes it to ``jq``. Roundtrip transcoding is available with the ``xq --xml-output``/``xq -x`` option. Multiple XML documents can be passed in separate files/streams as -``xq a.xml b.xml``. Entity expansion and DTD resolution is disabled to avoid XML parsing vulnerabilities. +``xq a.xml b.xml``. Use ``--xml-item-depth`` to descend into large documents, streaming their contents without loading +the full doc into memory (for example, stream a `Wikipedia database dump <https://dumps.wikimedia.org>`_ with +``cat enwiki-*.xml.bz2 | bunzip2 | xq . --xml-item-depth=2``). Entity expansion and DTD resolution is disabled to avoid +XML parsing vulnerabilities. TOML support ------------
