15
0

- Update to the version 3.5.1:

- Restore compatibility with argparse in Python 3.12.7+
  - Use project.scripts instead of setuptools scripts
  - Test infrastructure improvements
- Remove upstreamed patches:
  - argparse-3_12_7.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-argcomplete?expand=0&rev=80
This commit is contained in:
2024-10-29 17:08:44 +00:00
committed by Git OBS Bridge
parent 749886ae5f
commit c33f4bc810
5 changed files with 176 additions and 12 deletions

View File

@@ -18,27 +18,36 @@
%{?sle15_python_module_pythons}
Name: python-argcomplete
Version: 3.4.0
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
Name: python-argcomplete%{psuffix}
Version: 3.5.1
Release: 0
Summary: Bash tab completion for argparse
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/kislyuk/argcomplete
Source: https://files.pythonhosted.org/packages/source/a/argcomplete/argcomplete-%{version}.tar.gz
# PATCH-FIX-OPENSUSE argparse-3_12_7.patch gh#kislyuk/argcomplete#507 mcepl@suse.com
# fix the incompatibility with Python 3.12.7+
Patch0: argparse-3_12_7.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module pexpect}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 67.2}
BuildRequires: %{python_module setuptools_scm >= 6.2}
BuildRequires: %{python_module wheel}
BuildRequires: ca-certificates-mozilla
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module argcomplete == %{version}}
BuildRequires: %{python_module pexpect}
BuildRequires: ca-certificates-mozilla
BuildRequires: fish
BuildRequires: zsh
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
@@ -62,31 +71,40 @@ resources over the network).
%autosetup -p1 -n argcomplete-%{version}
%build
%if %{without test}
%pyproject_wheel
%endif
%install
%if %{without test}
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/activate-global-python-argcomplete
%python_clone -a %{buildroot}%{_bindir}/register-python-argcomplete
%python_clone -a %{buildroot}%{_bindir}/python-argcomplete-check-easy-install-script
rm %{buildroot}%{_bindir}/activate-global-python-argcomplete
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
%if %{with test}
export LANG=en_US.UTF-8
export TERM=xterm-mono
%{python_expand \
# https://github.com/kislyuk/argcomplete/issues/255
# https://github.com/kislyuk/argcomplete/issues/299
sed -i -e "1s|#!.*python.*|#!%{__$python}|" test/prog test/*.py scripts/*
sed -i -e "1s|#!.*python.*|#!%{__$python}|" test/prog test/*.py
sed -i -e "s|python3 |$python |g" test/test.py
PYTHONPATH=%{buildroot}%{$python_sitelib} $python ./test/test.py -v
}
%endif
%if %{without test}
%post
%python_install_alternative activate-global-python-argcomplete
%python_install_alternative register-python-argcomplete
%python_install_alternative python-argcomplete-check-easy-install-script
%postun
%python_uninstall_alternative activate-global-python-argcomplete
%python_uninstall_alternative register-python-argcomplete
%python_uninstall_alternative python-argcomplete-check-easy-install-script
@@ -95,7 +113,9 @@ export TERM=xterm-mono
%license LICENSE.rst
%{python_sitelib}/argcomplete-%{version}.dist-info
%{python_sitelib}/argcomplete
%python_alternative %{_bindir}/activate-global-python-argcomplete
%python_alternative %{_bindir}/python-argcomplete-check-easy-install-script
%python_alternative %{_bindir}/register-python-argcomplete
%endif
%changelog