Add argcomplete bcond
This commit is contained in:
parent
006891ac8b
commit
47238f9977
@ -1,6 +1,10 @@
|
||||
# several test dependencies are unwanted in RHEL
|
||||
%bcond tests %{undefined rhel}
|
||||
|
||||
# controls whether to generate shell completions
|
||||
# may be useful for bootstrapping purposes
|
||||
%bcond argcomplete 1
|
||||
|
||||
# disable the python -s shbang flag as we want to be able to find non system modules
|
||||
%undefine _py3_shebang_s
|
||||
|
||||
@ -53,8 +57,6 @@ BuildRequires: make
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
# Needed to build manpages from source.
|
||||
BuildRequires: python%{python3_pkgversion}-docutils
|
||||
# Shell completions
|
||||
BuildRequires: python%{python3_pkgversion}-argcomplete
|
||||
|
||||
%if %{with tests}
|
||||
BuildRequires: git-core
|
||||
@ -66,7 +68,9 @@ BuildRequires: python%{python3_pkgversion}-systemd
|
||||
BuildRequires: /usr/bin/python
|
||||
%endif
|
||||
|
||||
%if %{with argcomplete}
|
||||
Requires: python%{python3_pkgversion}-argcomplete
|
||||
%endif
|
||||
# Require packaging macros if rpm-build exists
|
||||
# This makes the transition seamless for other packages
|
||||
# This is DEPRECATED. Packages must explicitly BuildRequire ansible-packaging.
|
||||
@ -111,6 +115,10 @@ sed '/^mock$/d' test/lib/ansible_test/_data/requirements/units.txt > _requiremen
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires %{?with_tests:_requirements.txt test/units/requirements.txt}
|
||||
%if %{with argcomplete}
|
||||
# Shell completions
|
||||
echo 'python%{python3_pkgversion}-argcomplete'
|
||||
%endif
|
||||
|
||||
|
||||
%build
|
||||
@ -125,6 +133,7 @@ sed '/^mock$/d' test/lib/ansible_test/_data/requirements/units.txt > _requiremen
|
||||
# for more details.
|
||||
PYTHONPATH="$(pwd)/packaging" %{python3} %{S:1}
|
||||
|
||||
%if %{with argcomplete}
|
||||
# Build shell completions
|
||||
(
|
||||
cd bin
|
||||
@ -147,6 +156,7 @@ PYTHONPATH="$(pwd)/packaging" %{python3} %{S:1}
|
||||
done
|
||||
done
|
||||
)
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
@ -163,8 +173,10 @@ done < <(find \
|
||||
%{buildroot}%{python3_sitelib}/ansible/cli/scripts/ansible_connection_cli_stub.py \
|
||||
-type f ! -executable)
|
||||
|
||||
%if %{with argcomplete}
|
||||
install -Dpm 0644 bash_completions/* -t %{buildroot}%{bash_completions_dir}
|
||||
install -Dpm 0644 fish_completions/* -t %{buildroot}%{fish_completions_dir}
|
||||
%endif
|
||||
|
||||
# Create system directories that Ansible defines as default locations in
|
||||
# ansible/config/base.yml
|
||||
@ -232,8 +244,10 @@ install -Dpm 0644 licenses/* -t %{buildroot}%{_pkglicensedir}
|
||||
%config(noreplace) %{_sysconfdir}/ansible/*
|
||||
%{_bindir}/ansible*
|
||||
%{_datadir}/ansible/
|
||||
%if %{with argcomplete}
|
||||
%{bash_completions_dir}/ansible*
|
||||
%{fish_completions_dir}/ansible*.fish
|
||||
%endif
|
||||
%{_mandir}/man1/ansible*
|
||||
|
||||
%files doc
|
||||
|
Loading…
Reference in New Issue
Block a user