diff --git a/python-humanfriendly.changes b/python-humanfriendly.changes index 102eac1..1e8e1cf 100644 --- a/python-humanfriendly.changes +++ b/python-humanfriendly.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Oct 30 02:58:39 UTC 2024 - Steve Kowalik + +- Add patch support-python-313.patch: + * No longer use now-removed pipes module. +- Remove Python 2 leftovers. +- Switch to pyproject macros. + ------------------------------------------------------------------- Fri Apr 21 12:26:28 UTC 2023 - Dirk Müller diff --git a/python-humanfriendly.spec b/python-humanfriendly.spec index d6bdc63..d5e018f 100644 --- a/python-humanfriendly.spec +++ b/python-humanfriendly.spec @@ -1,7 +1,7 @@ # -# spec file +# spec file for package python-humanfriendly # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,8 +24,6 @@ %define psuffix %{nil} %bcond_with test %endif -%bcond_without python2 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?sle15_python_module_pythons} Name: python-humanfriendly%{psuffix} Version: 10.0 @@ -38,12 +36,16 @@ Source: https://files.pythonhosted.org/packages/source/h/humanfriendly/h Patch0: python-humanfriendly-no-mock.patch # PATCH-FIX-UPSTREAM gh#xolox/python-humanfriendly#65 Patch1: pytest-7-support.patch +# PATCH-FIX-UPSTREAM gh#xolox/python-humanfriendly#75 +Patch2: support-python-313.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %if %{with test} BuildRequires: %{python_module capturer >= 2.1} @@ -52,12 +54,6 @@ BuildRequires: %{python_module docutils} BuildRequires: %{python_module pytest >= 3.0.7} BuildRequires: %{python_module pytest-cov >= 2.4.0} BuildRequires: %{pythons} -%if %{with python2} -BuildRequires: python2-monotonic -%endif -%endif -%ifpython2 -Requires: python-monotonic %endif %python_subpackages @@ -79,11 +75,11 @@ text interfaces more user friendly. %autosetup -p1 -n humanfriendly-%{version} %build -%python_build +%pyproject_wheel %install %if !%{with test} -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/humanfriendly %{python_expand chmod a+x %{buildroot}%{$python_sitelib}/humanfriendly/tests.py sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}%{$python_sitelib}/humanfriendly/tests.py @@ -110,7 +106,7 @@ $python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/hu %doc README.rst %python_alternative %{_bindir}/humanfriendly %{python_sitelib}/humanfriendly -%{python_sitelib}/humanfriendly-%{version}-py*.egg-info +%{python_sitelib}/humanfriendly-%{version}.dist-info %endif %changelog diff --git a/support-python-313.patch b/support-python-313.patch new file mode 100644 index 0000000..27ceb15 --- /dev/null +++ b/support-python-313.patch @@ -0,0 +1,75 @@ +From 13d05b8057010121acd2a402a337ef4ee5834062 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Thu, 30 May 2024 23:05:14 -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 #73. +--- + humanfriendly/cli.py | 8 ++++++-- + humanfriendly/testing.py | 8 ++++++-- + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/humanfriendly/cli.py b/humanfriendly/cli.py +index eb81db1..5dfc14a 100644 +--- a/humanfriendly/cli.py ++++ b/humanfriendly/cli.py +@@ -79,10 +79,14 @@ + # Standard library modules. + import functools + import getopt +-import pipes + import subprocess + import sys + ++try: ++ from shlex import quote # Python 3 ++except ImportError: ++ from pipes import quote # Python 2 (removed in 3.13) ++ + # Modules included in our package. + from humanfriendly import ( + Timer, +@@ -176,7 +180,7 @@ def main(): + def run_command(command_line): + """Run an external command and show a spinner while the command is running.""" + timer = Timer() +- spinner_label = "Waiting for command: %s" % " ".join(map(pipes.quote, command_line)) ++ spinner_label = "Waiting for command: %s" % " ".join(map(quote, command_line)) + with Spinner(label=spinner_label, timer=timer) as spinner: + process = subprocess.Popen(command_line) + while True: +diff --git a/humanfriendly/testing.py b/humanfriendly/testing.py +index f6abddf..f9d66e4 100644 +--- a/humanfriendly/testing.py ++++ b/humanfriendly/testing.py +@@ -25,13 +25,17 @@ + import functools + import logging + import os +-import pipes + import shutil + import sys + import tempfile + import time + import unittest + ++try: ++ from shlex import quote # Python 3 ++except ImportError: ++ from pipes import quote # Python 2 (removed in 3.13) ++ + # Modules included in our package. + from humanfriendly.compat import StringIO + from humanfriendly.text import random_string +@@ -521,7 +525,7 @@ def __enter__(self): + pathname = os.path.join(directory, self.program_name) + with open(pathname, 'w') as handle: + handle.write('#!/bin/sh\n') +- handle.write('echo > %s\n' % pipes.quote(self.program_signal_file)) ++ handle.write('echo > %s\n' % quote(self.program_signal_file)) + if self.program_script: + handle.write('%s\n' % self.program_script.strip()) + handle.write('exit %i\n' % self.program_returncode)