[Debian-astro-maintainers] Bug#934272: python-asdf: newer pyyaml changes default_flow_style

Mathieu Trudel-Lapierre cyphermox at ubuntu.com
Thu Aug 8 23:16:56 BST 2019


Package: python-asdf
Version: 2.3.3-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Dear Maintainer,

default_flow_style=None changed to default_flow_style=False by default
in pyyaml 5.1 [1].

I wrote the following pretty heavy-handed patch to address the situation
and maintain previous behavior, though you might want to change the tests
instead and follow the changes made upstream.

[1] https://github.com/yaml/pyyaml/issues/265


*** /tmp/tmpGHYumu/bug_body

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/patches/fix_pyyaml_default_flow_style.patch: Make sure all calls
    to yaml.dump() include default_flow_style=None, to retain previous behavior
    that is checked for in tests, unless it's already otherwise specified.


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers eoan
  APT policy: (500, 'eoan')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-8-generic (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru python-asdf-2.3.3/debian/patches/fix_pyyaml_default_flow_style.patch python-asdf-2.3.3/debian/patches/fix_pyyaml_default_flow_style.patch
--- python-asdf-2.3.3/debian/patches/fix_pyyaml_default_flow_style.patch	1969-12-31 19:00:00.000000000 -0500
+++ python-asdf-2.3.3/debian/patches/fix_pyyaml_default_flow_style.patch	2019-08-08 17:58:05.000000000 -0400
@@ -0,0 +1,31 @@
+From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre at canonical.com>
+Subject: Force yaml.dump() calls to specify default_flow_style=None
+
+default_flow_style changed to False by default, which actually changes
+the output format. Make sure we retain the previous behavior expected
+by the tests.
+
+cf. https://github.com/yaml/pyyaml/issues/265
+
+Index: python-asdf-2.3.3/asdf/block.py
+===================================================================
+--- python-asdf-2.3.3.orig/asdf/block.py
++++ python-asdf-2.3.3/asdf/block.py
+@@ -397,6 +397,7 @@ class BlockManager:
+                 offsets, Dumper=yamlutil._yaml_base_dumper, stream=fd,
+                 explicit_start=True, explicit_end=True,
+                 version=yaml_version,
++                default_flow_style=None,
+                 allow_unicode=True, encoding='utf-8')
+ 
+     _re_index_content = re.compile(
+Index: python-asdf-2.3.3/asdf/yamlutil.py
+===================================================================
+--- python-asdf-2.3.3.orig/asdf/yamlutil.py
++++ python-asdf-2.3.3/asdf/yamlutil.py
+@@ -340,4 +340,5 @@ def dump_tree(tree, fd, ctx):
+         explicit_start=True, explicit_end=True,
+         version=yaml_version,
+         allow_unicode=True, encoding='utf-8',
++        default_flow_style=None,
+         tags=tags)
diff -Nru python-asdf-2.3.3/debian/patches/series python-asdf-2.3.3/debian/patches/series
--- python-asdf-2.3.3/debian/patches/series	2019-07-18 08:16:44.000000000 -0400
+++ python-asdf-2.3.3/debian/patches/series	2019-08-08 17:56:37.000000000 -0400
@@ -3,3 +3,4 @@
 Emulate-importlib.resources-for-Python-3.6.patch
 Remove-loopback-internet-access-test.patch
 Remove-test-that-requires-the-non-existence-of-an-externa.patch
+fix_pyyaml_default_flow_style.patch


More information about the Debian-astro-maintainers mailing list