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

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