forked from pool/python-humanfriendly
Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| a0f73286fa | |||
| db24f74402 | |||
| bf43797ef4 | |||
| 446e4b0b82 |
@@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 10 13:10:47 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
|
- Convert to libalternatives
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 30 02:58:39 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- 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 <dmueller@suse.com>
|
Fri Apr 21 12:26:28 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file
|
# spec file for package python-humanfriendly
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -24,8 +24,7 @@
|
|||||||
%define psuffix %{nil}
|
%define psuffix %{nil}
|
||||||
%bcond_with test
|
%bcond_with test
|
||||||
%endif
|
%endif
|
||||||
%bcond_without python2
|
%bcond_without libalternatives
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-humanfriendly%{psuffix}
|
Name: python-humanfriendly%{psuffix}
|
||||||
Version: 10.0
|
Version: 10.0
|
||||||
@@ -38,12 +37,16 @@ Source: https://files.pythonhosted.org/packages/source/h/humanfriendly/h
|
|||||||
Patch0: python-humanfriendly-no-mock.patch
|
Patch0: python-humanfriendly-no-mock.patch
|
||||||
# PATCH-FIX-UPSTREAM gh#xolox/python-humanfriendly#65
|
# PATCH-FIX-UPSTREAM gh#xolox/python-humanfriendly#65
|
||||||
Patch1: pytest-7-support.patch
|
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 setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
|
BuildRequires: alts
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
Requires: alts
|
||||||
Requires: python
|
Requires: python
|
||||||
Requires(post): update-alternatives
|
|
||||||
Requires(postun):update-alternatives
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if %{with test}
|
%if %{with test}
|
||||||
BuildRequires: %{python_module capturer >= 2.1}
|
BuildRequires: %{python_module capturer >= 2.1}
|
||||||
@@ -52,12 +55,6 @@ BuildRequires: %{python_module docutils}
|
|||||||
BuildRequires: %{python_module pytest >= 3.0.7}
|
BuildRequires: %{python_module pytest >= 3.0.7}
|
||||||
BuildRequires: %{python_module pytest-cov >= 2.4.0}
|
BuildRequires: %{python_module pytest-cov >= 2.4.0}
|
||||||
BuildRequires: %{pythons}
|
BuildRequires: %{pythons}
|
||||||
%if %{with python2}
|
|
||||||
BuildRequires: python2-monotonic
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
%ifpython2
|
|
||||||
Requires: python-monotonic
|
|
||||||
%endif
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@@ -79,11 +76,11 @@ text interfaces more user friendly.
|
|||||||
%autosetup -p1 -n humanfriendly-%{version}
|
%autosetup -p1 -n humanfriendly-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if !%{with test}
|
%if !%{with test}
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_clone -a %{buildroot}%{_bindir}/humanfriendly
|
%python_clone -a %{buildroot}%{_bindir}/humanfriendly
|
||||||
%{python_expand chmod a+x %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
|
%{python_expand chmod a+x %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
|
||||||
sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
|
sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
|
||||||
@@ -99,18 +96,15 @@ $python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/hu
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if !%{with test}
|
%if !%{with test}
|
||||||
%post
|
%pre
|
||||||
%python_install_alternative humanfriendly
|
%python_libalternatives_reset_alternative humanfriendly
|
||||||
|
|
||||||
%postun
|
|
||||||
%python_uninstall_alternative humanfriendly
|
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%python_alternative %{_bindir}/humanfriendly
|
%python_alternative %{_bindir}/humanfriendly
|
||||||
%{python_sitelib}/humanfriendly
|
%{python_sitelib}/humanfriendly
|
||||||
%{python_sitelib}/humanfriendly-%{version}-py*.egg-info
|
%{python_sitelib}/humanfriendly-%{version}.dist-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
75
support-python-313.patch
Normal file
75
support-python-313.patch
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
From 13d05b8057010121acd2a402a337ef4ee5834062 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
||||||
|
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)
|
||||||
Reference in New Issue
Block a user