From b3a78363a1e42767526fef3285002cd067c65ab94f9d92b5b92f3f708a99efaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 28 May 2020 07:33:51 +0000 Subject: [PATCH] Accepting request 809555 from home:pgajdos:python submit OBS-URL: https://build.opensuse.org/request/show/809555 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-argcomplete?expand=0&rev=33 --- python-argcomplete.changes | 5 +++++ python-argcomplete.spec | 31 +++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/python-argcomplete.changes b/python-argcomplete.changes index 43a7dc2..76e9399 100644 --- a/python-argcomplete.changes +++ b/python-argcomplete.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed May 27 13:01:18 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + ------------------------------------------------------------------- Thu Apr 30 06:05:59 UTC 2020 - Tomáš Chvátal diff --git a/python-argcomplete.spec b/python-argcomplete.spec index 92afd16..53a8825 100644 --- a/python-argcomplete.spec +++ b/python-argcomplete.spec @@ -37,6 +37,8 @@ BuildRequires: fdupes BuildRequires: fish BuildRequires: python-rpm-macros Requires: python-importlib-metadata >= 0.23 +Requires(post): update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %python_subpackages @@ -57,32 +59,45 @@ resources over the network). %prep %setup -q -n argcomplete-%{version} %autopatch -p1 -# https://github.com/kislyuk/argcomplete/issues/255 -# https://github.com/kislyuk/argcomplete/issues/256 -sed -i -e "1s|#!.*python.*|#!%{__python3}|" test/prog scripts/* -sed -i -e "s|python |python3 |g" test/test.py %build %python_build %install %python_install +%python_clone -a %{buildroot}%{_bindir}/register-python-argcomplete +%python_clone -a %{buildroot}%{_bindir}/python-argcomplete-check-easy-install-script rm -rf %{buildroot}%{python_sitelib}/test rm %{buildroot}%{_bindir}/activate-global-python-argcomplete -%python_expand %fdupes %{buildroot}%{$python_sitelib} # tcsh support is broken rm %{buildroot}%{_bindir}/python-argcomplete-tcsh +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check export LANG=en_US.UTF-8 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest discover -v +%{python_expand \ + # https://github.com/kislyuk/argcomplete/issues/255 + # https://github.com/kislyuk/argcomplete/issues/256 + # https://github.com/kislyuk/argcomplete/issues/299 + sed -i -e "1s|#!.*python.*|#!%{_bindir}/$python|" test/prog scripts/* + sed -i -e "s|python |$python |g" test/test.py + PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest discover -v +} + +%post +%python_install_alternative register-python-argcomplete +%python_install_alternative python-argcomplete-check-easy-install-script + +%postun +%python_uninstall_alternative register-python-argcomplete +%python_uninstall_alternative python-argcomplete-check-easy-install-script %files %{python_files} %doc README.rst %license LICENSE.rst %{python_sitelib}/argcomplete-%{version}-py%{python_version}.egg-info %{python_sitelib}/argcomplete -%python3_only %{_bindir}/python-argcomplete-check-easy-install-script -%python3_only %{_bindir}/register-python-argcomplete +%python_alternative %{_bindir}/python-argcomplete-check-easy-install-script +%python_alternative %{_bindir}/register-python-argcomplete %changelog