diff --git a/python-coloredlogs.changes b/python-coloredlogs.changes index 5ed2fb2..a618acd 100644 --- a/python-coloredlogs.changes +++ b/python-coloredlogs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Oct 30 02:59:26 UTC 2024 - Steve Kowalik + +- Add patch support-python-313.patch: + * No longer use now-removed pipes module. + ------------------------------------------------------------------- Fri Apr 21 12:23:28 UTC 2023 - Dirk Müller diff --git a/python-coloredlogs.spec b/python-coloredlogs.spec index 0fc5388..d087b04 100644 --- a/python-coloredlogs.spec +++ b/python-coloredlogs.spec @@ -1,7 +1,7 @@ # # spec file for package python-coloredlogs # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # Copyright (c) 2016, Martin Hauke # # All modifications and additions to the file contributed by third parties @@ -23,25 +23,26 @@ Version: 15.0.1 Release: 0 Summary: Colored terminal output for Python's logging module License: MIT -Group: Development/Languages/Python URL: https://github.com/xolox/python-coloredlogs Source: https://files.pythonhosted.org/packages/source/c/coloredlogs/coloredlogs-%{version}.tar.gz # PATCH-FIX-OPENSUSE test_cli_conversion_test.patch mcepl@suse.com # With using alternatives, we don't have versionless command in time of %%check Patch0: test_cli_conversion_test.patch +# PATCH-FIX-UPSTREAM gh#xolox/python-coloredlogs#120 +Patch1: support-python-313.patch BuildRequires: %{python_module capturer >= 2.4} BuildRequires: %{python_module humanfriendly >= 9.1} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest >= 3.0.3} BuildRequires: %{python_module pytest-cov >= 2.3.1} -BuildRequires: %{python_module pip} -BuildRequires: %{python_module wheel} BuildRequires: %{python_module verboselogs >= 1.7} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-capturer >= 2.4 Requires: python-humanfriendly >= 9.1 Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives Recommends: python-verboselogs >= 1.7 BuildArch: noarch %python_subpackages @@ -83,6 +84,6 @@ export PATH=%{buildroot}%{_bindir}:$PATH %python_alternative %{_bindir}/coloredlogs %{python_sitelib}/coloredlogs/ %{python_sitelib}/coloredlogs.pth -%{python_sitelib}/coloredlogs-%{version}*-info +%{python_sitelib}/coloredlogs-%{version}.dist-info %changelog diff --git a/support-python-313.patch b/support-python-313.patch new file mode 100644 index 0000000..98de43b --- /dev/null +++ b/support-python-313.patch @@ -0,0 +1,43 @@ +From 9d4f4020897fcf48d381de8e099dc29b53fc9531 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Wed, 12 Jun 2024 14:00:28 -0400 +Subject: [PATCH] Replace pipes.quote with shlex.quote on Python 3 + +The shlex.quote() API is available from Python 3.3 on; pipes.quote() was +never documented, and is removed in Python 3.13. + +Fixes #119. +--- + coloredlogs/converter/__init__.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/coloredlogs/converter/__init__.py b/coloredlogs/converter/__init__.py +index a424469..96817a0 100644 +--- a/coloredlogs/converter/__init__.py ++++ b/coloredlogs/converter/__init__.py +@@ -9,11 +9,15 @@ + # Standard library modules. + import codecs + import os +-import pipes + import re + import subprocess + import tempfile + ++try: ++ from shlex import quote # Python 3 ++except ImportError: ++ from pipes import quote # Python 2 (removed in 3.13) ++ + # External dependencies. + from humanfriendly.terminal import ( + ANSI_CSI, +@@ -75,7 +79,7 @@ def capture(command, encoding='UTF-8'): + # + # [1] http://man7.org/linux/man-pages/man1/script.1.html + # [2] https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/script.1.html +- command_line = ['script', '-qc', ' '.join(map(pipes.quote, command)), '/dev/null'] ++ command_line = ['script', '-qc', ' '.join(map(quote, command)), '/dev/null'] + script = subprocess.Popen(command_line, stdout=subprocess.PIPE, stderr=dev_null) + stdout, stderr = script.communicate() + if script.returncode == 0: