From a6b4355d577d519cf3b4d54b2f6055ca0580b606 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Aug 21 2019 11:44:54 +0000 Subject: Python 3.8 compatibility in docs See https://bugzilla.redhat.com/show_bug.cgi?id=1712531 and https://github.com/ansible/ansible/pull/56806 --- diff --git a/56806.patch b/56806.patch new file mode 100644 index 0000000..db06d26 --- /dev/null +++ b/56806.patch @@ -0,0 +1,50 @@ +From 702e044b90fd0a0524fa4574648fe7dae4d4f2fe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Wed, 22 May 2019 21:31:22 +0200 +Subject: [PATCH] Don't change dictionary keys during iteration + +With Python 3.8.0a4+, we get the following RuntimeError in Fedora: + +PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml +Traceback (most recent call last): + File "../bin/dump_keywords.py", line 49, in + for a in oblist[name]: +RuntimeError: dictionary keys changed during iteration + +And: + + def populate(self): + super(Interfaces, self).populate() + self.facts['all_ipv4_addresses'] = list() + self.facts['all_ipv6_addresses'] = list() + + data = self.responses[0] + interfaces = self.parse_interfaces(data) + +> for key in interfaces.keys(): +E RuntimeError: dictionary keys changed during iteration + +In TestDellos9Facts.test_dellos9_facts_gather_subset_default +and TestDellos9Facts.test_dellos9_facts_gather_subset_interfaces. + +Python change: https://github.com/python/cpython/pull/12596 + +Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1712531 +--- + docs/bin/dump_keywords.py | 2 +- + lib/ansible/modules/network/dellos9/dellos9_facts.py | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/docs/bin/dump_keywords.py b/docs/bin/dump_keywords.py +index 30056a6fc8cc..e25171126576 100755 +--- a/docs/bin/dump_keywords.py ++++ b/docs/bin/dump_keywords.py +@@ -46,7 +46,7 @@ + oblist[name] = dict((x, aobj.__dict__['_attributes'][x]) for x in aobj.__dict__['_attributes'] if 'private' not in x or not x.private) + + # pick up docs if they exist +- for a in oblist[name]: ++ for a in list(oblist[name]): + if a in docs: + oblist[name][a] = docs[a] + else: diff --git a/ansible.spec b/ansible.spec index 8f2d7f2..0675b24 100644 --- a/ansible.spec +++ b/ansible.spec @@ -41,6 +41,11 @@ Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz # upstream as they don't know what their customers are running. Patch100: ansible-newer-jinja.patch +# Python 3.8 compatibility in docs +# https://bugzilla.redhat.com/show_bug.cgi?id=1712531 +# rebased from https://github.com/ansible/ansible/pull/56806 +Patch101: 56806.patch + Url: http://ansible.com BuildArch: noarch @@ -262,6 +267,8 @@ This package installs extensive documentation for ansible %patch100 -p1 %endif +%patch101 -p1 + %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir}