From 5ce32992e7649f27fe74ca8c5f9723b2fc7859cc Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Sat, 30 May 2020 01:32:05 +0200 Subject: [PATCH] Fix Python 3.9 compatibility (#1808674) --- ansible.spec | 8 +++- fix-python-3.9-compatibility.patch | 63 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 fix-python-3.9-compatibility.patch diff --git a/ansible.spec b/ansible.spec index 6156e9e..860106a 100644 --- a/ansible.spec +++ b/ansible.spec @@ -18,7 +18,7 @@ Name: ansible Summary: SSH-based configuration management, deployment, and task execution system Version: 2.9.9 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz @@ -30,6 +30,9 @@ BuildArch: noarch # Disable failing test Patch2: ansible-2.9.6-disable-test_build_requirement_from_path_no_version.patch +# Fix Python 3.9 compatibility +# Backported from upstream: https://github.com/ansible/ansible/pull/67891 +Patch3: fix-python-3.9-compatibility.patch # We used to have a ansible-python3 package that a number of other things # started depending on, so we should now provide/obsolete it until they @@ -231,6 +234,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Fri May 29 2020 Charalampos Stratakis - 2.9.9-3 +- Fix Python 3.9 compatibility (#1808674) + * Tue May 26 2020 Miro HronĨok - 2.9.9-2 - Rebuilt for Python 3.9 diff --git a/fix-python-3.9-compatibility.patch b/fix-python-3.9-compatibility.patch new file mode 100644 index 0000000..97faf39 --- /dev/null +++ b/fix-python-3.9-compatibility.patch @@ -0,0 +1,63 @@ +diff --git a/shippable.yml b/shippable.yml +index 4ad9f63b..2ded6041 100644 +--- a/shippable.yml ++++ b/shippable.yml +@@ -20,6 +20,7 @@ matrix: + - env: T=units/3.6/1 + - env: T=units/3.7/1 + - env: T=units/3.8/1 ++ - env: T=units/3.9/1 + + - env: T=units/2.6/2 + - env: T=units/2.7/2 +@@ -27,6 +28,7 @@ matrix: + - env: T=units/3.6/2 + - env: T=units/3.7/2 + - env: T=units/3.8/2 ++ - env: T=units/3.9/2 + + - env: T=windows/2012/1 + - env: T=windows/2012-R2/1 +diff --git a/test/lib/ansible_test/_data/completion/docker.txt b/test/lib/ansible_test/_data/completion/docker.txt +index 78653dad..bbc2734d 100644 +--- a/test/lib/ansible_test/_data/completion/docker.txt ++++ b/test/lib/ansible_test/_data/completion/docker.txt +@@ -1,4 +1,4 @@ +-default name=quay.io/ansible/default-test-container:1.10.1 python=3.6,2.6,2.7,3.5,3.7,3.8 seccomp=unconfined ++default name=quay.io/ansible/default-test-container:1.11 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined + centos6 name=quay.io/ansible/centos6-test-container:1.8.0 python=2.6 seccomp=unconfined + centos7 name=quay.io/ansible/centos7-test-container:1.8.0 python=2.7 seccomp=unconfined + centos8 name=quay.io/ansible/centos8-test-container:1.10.0 python=3.6 seccomp=unconfined +diff --git a/test/lib/ansible_test/_data/sanity/compile/compile.py b/test/lib/ansible_test/_data/sanity/compile/compile.py +index 3a2a0ddb..61910eee 100755 +--- a/test/lib/ansible_test/_data/sanity/compile/compile.py ++++ b/test/lib/ansible_test/_data/sanity/compile/compile.py +@@ -3,7 +3,15 @@ + from __future__ import (absolute_import, division, print_function) + __metaclass__ = type + +-import parser ++import warnings ++ ++with warnings.catch_warnings(): ++ # The parser module is deprecated as of Python 3.9. ++ # This implementation will need to be updated to use another solution. ++ # Until then, disable the deprecation warnings to prevent test failures. ++ warnings.simplefilter('ignore', DeprecationWarning) ++ import parser ++ + import sys + + +diff --git a/test/lib/ansible_test/_internal/util.py b/test/lib/ansible_test/_internal/util.py +index 72058cb9..6c55434b 100644 +--- a/test/lib/ansible_test/_internal/util.py ++++ b/test/lib/ansible_test/_internal/util.py +@@ -110,6 +110,7 @@ SUPPORTED_PYTHON_VERSIONS = ( + '3.6', + '3.7', + '3.8', ++ '3.9', + ) + +