Ship bash completion file within RPM

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2015-12-05 18:41:59 +01:00
parent fb1cec6979
commit bd008f6edd

View File

@ -1,27 +1,17 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %global modname argcomplete
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%if 0%{?fedora} %if 0%{?fedora}
%global with_python3 1 %global with_python3 1
%endif %endif
Summary: Bash tab completion for argparse Name: python-%{modname}
Name: python-argcomplete Summary: Bash tab completion for argparse
Version: 1.0.0 Version: 1.0.0
Release: 2%{?dist} Release: 3%{?dist}
License: ASL 2.0 License: ASL 2.0
Group: Development/Libraries URL: https://github.com/kislyuk/argcomplete
Url: https://github.com/kislyuk/argcomplete Source0: http://pypi.python.org/packages/source/a/argcomplete/%{modname}-%{version}.tar.gz
Source0: http://pypi.python.org/packages/source/a/argcomplete/argcomplete-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python-tools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
BuildArch: noarch BuildArch: noarch
Requires: python-argparse
%description %description
Argcomplete provides easy, extensible command line tab completion of Argcomplete provides easy, extensible command line tab completion of
@ -37,11 +27,13 @@ options or subparsers, and if your program can dynamically suggest
completions for your argument/option values (for example, if the user completions for your argument/option values (for example, if the user
is browsing resources over the network). is browsing resources over the network).
%package -n python2-argcomplete %package -n python2-%{modname}
Summary: %{summary} Summary: %{summary}
%{?python_provide:%python_provide python2-argcomplete} %{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%description -n python2-argcomplete %description -n python2-%{modname}
Argcomplete provides easy, extensible command line tab completion of Argcomplete provides easy, extensible command line tab completion of
arguments for your Python script. arguments for your Python script.
@ -55,12 +47,17 @@ options or subparsers, and if your program can dynamically suggest
completions for your argument/option values (for example, if the user completions for your argument/option values (for example, if the user
is browsing resources over the network). is browsing resources over the network).
Python 2 version.
%if 0%{?with_python3} %if 0%{?with_python3}
%package -n python3-argcomplete %package -n python3-%{modname}
Summary: %{summary} Summary: %{summary}
%{?python_provide:%python_provide python3-argcomplete} %{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python-tools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%description -n python3-argcomplete %description -n python3-%{modname}
Argcomplete provides easy, extensible command line tab completion of Argcomplete provides easy, extensible command line tab completion of
arguments for your Python script. arguments for your Python script.
@ -74,10 +71,11 @@ options or subparsers, and if your program can dynamically suggest
completions for your argument/option values (for example, if the user completions for your argument/option values (for example, if the user
is browsing resources over the network). is browsing resources over the network).
Python 3 version.
%endif %endif
%prep %prep
%setup -n argcomplete-%{version} -q %setup -n %{modname}-%{version} -q
%build %build
%py2_build %py2_build
@ -94,26 +92,27 @@ done
%endif %endif
%py2_install %py2_install
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
%if 0%{?with_python3} %if 0%{?with_python3}
for file in activate-global-python-argcomplete python-argcomplete-check-easy-install-script register-python-argcomplete ; do for file in activate-global-python-argcomplete python-argcomplete-check-easy-install-script register-python-argcomplete ; do
mv ./$file.py3 %{buildroot}%{_bindir}/$file mv ./$file.py3 %{buildroot}%{_bindir}/$file
done done
install -p -m0644 %{python3_sitelib}/%{modname}/bash_completion.d/python-argcomplete.sh %{buildroot}%{_sysconfdir}/bash_completion.d/
%else
install -p -m0644 %{python2_sitelib}/%{modname}/bash_completion.d/python-argcomplete.sh %{buildroot}%{_sysconfdir}/bash_completion.d/
%endif %endif
%files -n python2-%{modname}
%files -n python2-argcomplete
%license LICENSE.rst %license LICENSE.rst
%doc README.rst %doc README.rst
%{python_sitelib}/argcomplete-%{version}-py*.egg-info %{python2_sitelib}/%{modname}*
%{python_sitelib}/argcomplete/
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-argcomplete %files -n python3-%{modname}
%license LICENSE.rst %license LICENSE.rst
%doc README.rst %doc README.rst
%{python3_sitelib}/argcomplete-%{version}-py*.egg-info %{python3_sitelib}/%{modname}*
%{python3_sitelib}/argcomplete/
%endif %endif
# This goes in the python2-argcomplete package when we build without python3, # This goes in the python2-argcomplete package when we build without python3,
@ -121,9 +120,13 @@ done
%{_bindir}/activate-global-python-argcomplete %{_bindir}/activate-global-python-argcomplete
%{_bindir}/python-argcomplete-check-easy-install-script %{_bindir}/python-argcomplete-check-easy-install-script
%{_bindir}/register-python-argcomplete %{_bindir}/register-python-argcomplete
%{_sysconfdir}/bash_completion.d/python-argcomplete.sh
%changelog %changelog
* Sat Nov 14 2015 Toshio Kuratomi <toshio@fedoraproject.org> - - 1.0.0-2 * Sat Dec 05 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 1.0.0-3
- Ship bash completion file within RPM
* Sat Nov 14 2015 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.0-2
- A few minor changes to simplify and take care of cornercases - A few minor changes to simplify and take care of cornercases
* Sat Nov 14 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@laptop> - 1.0.0-1 * Sat Nov 14 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@laptop> - 1.0.0-1