Use %bcond_(with|without) to enable/disable python3

The with_python3 macro was added in 7ac1fbc ("Avoid python dependency in
git-core ()", 2018-01-22) and followed the example from a devel
list request¹.

The %bcond_(with|without) macro allows enabling or disabling of python3
via the command line, modulemd file, etc.  Use it.

¹ https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/UG6XYG3EPLMLA5N47AK63NCF2Y6MDWFJ/
This commit is contained in:
Todd Zullinger 2018-04-02 17:41:16 -04:00
parent 73282c0771
commit 07e03fdaa0

View File

@ -12,9 +12,9 @@
# Settings for Fedora and EL > 7
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%bcond_without python3
%else
%global with_python3 0
%bcond_with python3
%endif
# Settings for Fedora and EL >= 7
@ -177,7 +177,7 @@ BuildRequires: perl(Memoize)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
BuildRequires: python2-devel
%if 0%{?with_python3}
%if %{with python3}
BuildRequires: python3-devel
%endif
BuildRequires: subversion
@ -487,7 +487,7 @@ sed -i -e '1s|#! */usr/bin/env python$|#!%{__python2}|' \
contrib/hooks/multimail/migrate-mailhook-config \
contrib/hooks/multimail/post-receive.example \
contrib/svn-fe/svnrdump_sim.py
%if 0%{?with_python3}
%if %{with python3}
sed -i -e '1s|#!%{__python2}$|#!%{__python3}|' \
contrib/hooks/multimail/git_multimail.py \
contrib/hooks/multimail/migrate-mailhook-config \
@ -867,6 +867,7 @@ make test || ./print-failed-test-output
%changelog
* Mon Apr 02 2018 Todd Zullinger <tmz@pobox.com>
- Allow git-p4 subpackage to be toggled via --with/--without
- Use %%bcond_(with|without) to enable/disable python3
* Mon Apr 02 2018 Todd Zullinger <tmz@pobox.com> - 2.17.0-1
- Update to 2.17.0