1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# Build scheme: pyproject (setuptools backend, openEuler 24.03 LTS SP4)
# pyproject.toml build-backend = "setuptools.build_meta"
# Pure Python noarch package; runtime deps mirrored to BuildRequires for import test.
#
# Adaptations for openEuler 24.03 LTS SP4 build environment (setuptools 68.0.0 < 77):
# 1. setuptools-scm not in repos (register-dep blocks toolchain registration):
# patch pyproject.toml to pin static version, remove setuptools-scm from
# [build-system].requires, drop [tool.setuptools_scm] section.
# 2. PEP 639 SPDX license string ("license = "MIT"") needs setuptools >= 77:
# convert to PEP 621 table form {text = "MIT"} and remove license-files field.
%global pypi_name cmd2
Name: python-%{pypi_name}
Version: 4.3.1
Release: 1%{?dist}
Summary: Tool for building powerful command-line applications in Python
License: MIT
URL: https://github.com/python-cmd2/cmd2
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildArch: noarch
%description
cmd2 is a tool for building powerful command-line applications in Python. It
extends the Python Standard Library's cmd module to provide a rich set of
features including tab completion, command history, scripting, aliases, and
more, making it easy to build feature-rich and user-friendly CLI apps.
%package -n python3-%{pypi_name}
Summary: Tool for building powerful command-line applications in Python
Provides: python-%{pypi_name}
Provides: python3dist(%{pypi_name}) = %{version}
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: pyproject-rpm-macros
BuildRequires: python3-setuptools
# Runtime deps mirrored as BuildRequires to support %check import test
BuildRequires: python3-prompt-toolkit >= 3.0.53
BuildRequires: python3-pyperclip >= 1.8.2
BuildRequires: python3-rich >= 15.0.0
BuildRequires: python3-rich-argparse >= 1.7.2
Requires: python3-prompt-toolkit >= 3.0.53
Requires: python3-pyperclip >= 1.8.2
Requires: python3-rich >= 15.0.0
Requires: python3-rich-argparse >= 1.7.2
%description -n python3-%{pypi_name}
cmd2 is a tool for building powerful command-line applications in Python. It
extends the Python Standard Library's cmd module to provide a rich set of
features including tab completion, command history, scripting, aliases, and
more, making it easy to build feature-rich and user-friendly CLI apps.
%package help
Summary: Development documents and examples for %{pypi_name}
Provides: python3-%{pypi_name}-doc
Requires: python3-%{pypi_name}
%description help
cmd2 is a tool for building powerful command-line applications in Python.
This package provides documentation and examples for %{pypi_name}.
%prep
%autosetup -n %{name}-%{version}
# Adapt pyproject.toml for openEuler 24.03 LTS SP4 (setuptools 68.0.0 < 77):
# 1. setuptools-scm not in repos -> pin static version, drop setuptools-scm
sed -i 's/^dynamic = \["version"\]/version = "%{version}"/' pyproject.toml
sed -i 's/, "setuptools-scm>=9.2.1"//' pyproject.toml
sed -i '/^\[tool.setuptools_scm\]$/d' pyproject.toml
# 2. PEP 639 SPDX license string needs setuptools >= 77 -> PEP 621 table form
sed -i 's/^license = "MIT"/license = {text = "MIT"}/' pyproject.toml
sed -i '/^license-files/d' pyproject.toml
%build
%pyproject_build
%install
%pyproject_install
%check
# Use bare python3 command; the python3 rpm macro is undefined on openEuler 24.03 LTS SP4.
python3 -c "import cmd2; print(cmd2.__file__)"
%files -n python3-%{pypi_name}
%license LICENSE
%{python3_sitelib}/cmd2/
%{python3_sitelib}/cmd2-%{version}*.dist-info/
%files help
%doc README.md
%doc CHANGELOG.md
%changelog
* Wed Oct 28 2026 Python_Bot <Python_Bot@openeuler.org> - 4.3.1-1
- Initial package
|