Blame SOURCES/0019-Silence-a-deprecation-warning-in-plugins-copr.py.patch

2d80f0
From a07db6dcd669eecb27b7ddbf1b85cd842bdcc35b Mon Sep 17 00:00:00 2001
2d80f0
From: Otto Urpelainen <oturpe@iki.fi>
2d80f0
Date: Wed, 6 Oct 2021 22:08:54 +0300
2d80f0
Subject: [PATCH] Silence a deprecation warning in plugins/copr.py
2d80f0
2d80f0
In version 1.6.0, the 'distro' package deprecated linux_distribution().
2d80f0
This causes a deprecation warning to printed to stdout
2d80f0
every time the user calls the copr plugin.
2d80f0
2d80f0
In order to avoid the printout
2d80f0
and to protect against possible removal in the future,
2d80f0
the function is reimplemented
2d80f0
using still supported functions from 'distro'.
2d80f0
2d80f0
= changelog =
2d80f0
msg: [copr] Avoid using deprecated function distro.linux_distribution()
2d80f0
type: bugfix
2d80f0
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2011550
2d80f0
---
2d80f0
 plugins/copr.py | 6 +++++-
2d80f0
 1 file changed, 5 insertions(+), 1 deletion(-)
2d80f0
2d80f0
diff --git a/plugins/copr.py b/plugins/copr.py
2d80f0
index c216408..9f597dd 100644
2d80f0
--- a/plugins/copr.py
2d80f0
+++ b/plugins/copr.py
2d80f0
@@ -38,7 +38,11 @@ import rpm
2d80f0
 # If that fails, attempt to import the deprecated implementation
2d80f0
 # from the platform module.
2d80f0
 try:
2d80f0
-    from distro import linux_distribution, os_release_attr
2d80f0
+    from distro import name, version, codename, os_release_attr
2d80f0
+
2d80f0
+    # Re-implement distro.linux_distribution() to avoid a deprecation warning
2d80f0
+    def linux_distribution():
2d80f0
+        return (name(), version(), codename())
2d80f0
 except ImportError:
2d80f0
     def os_release_attr(_):
2d80f0
         return ""
2d80f0
-- 
2d80f0
2.36.1
2d80f0