Restore use of bcond for python conditionals

This commit is contained in:
John Dennis 2018-07-10 16:42:40 -04:00
parent 8b3285217b
commit 48bfbb4d12

View File

@ -1,20 +1,19 @@
%global srcname keycloak-httpd-client-install
%global summary Tools to configure Apache HTTPD as Keycloak client
%global with_python2 0
%global with_python3 0
%if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7)
%global with_python2 1
%bcond_without python2
%bcond_without python3
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%bcond_with python2
%bcond_without python3
%endif
Name: %{srcname}
Version: 0.8
Release: 5%{?dist}
Release: 6%{?dist}
Summary: %{summary}
%global git_tag RELEASE_%(r=%{version}; echo $r | tr '.' '_')
@ -25,7 +24,7 @@ Source0: https://github.com/jdennis/keycloak-httpd-client-install/archive
BuildArch: noarch
%if %{with_python2}
%if %{with python2}
BuildRequires: python2-devel
%endif # with_python2
@ -43,7 +42,7 @@ libraries and tools which can automate and simplify configuring an
Apache HTTPD authentication module and registering as a client of a
Keycloak IdP.
%if %{with_python2}
%if %{with python2}
%package -n python2-%{srcname}
Summary: %{summary}
@ -83,7 +82,7 @@ of a Keycloak server.
%autosetup -n %{srcname}-%{version}
%build
%if %{with_python2}
%if %{with python2}
%py2_build
%endif # with_python2
@ -92,7 +91,7 @@ of a Keycloak server.
%endif
%install
%if %{with_python2}
%if %{with python2}
# Must do the python2 install first because the scripts in /usr/bin are
# overwritten with every setup.py install, and in general we want the
# python3 version to be the default.
@ -104,7 +103,7 @@ of a Keycloak server.
# or equal to the py2 installed files. If both the py2 and py3 builds execute
# quickly the files end up with the same timestamps thus leaving the py2
# version in the py3 install. Therefore remove any files susceptible to this.
%if %{with_python2}
%if %{with python2}
rm %{buildroot}%{_bindir}/keycloak-httpd-client-install
%endif # with_python2
%py3_install
@ -118,7 +117,7 @@ install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/ma
%doc README.md doc/ChangeLog
%{_datadir}/%{srcname}/
%if %{with_python2}
%if %{with python2}
# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
%files -n python2-%{srcname}
%{python2_sitelib}/*
@ -137,6 +136,9 @@ install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/ma
%endif
%changelog
* Tue Jul 10 2018 <jdennis@redhat.com> - 0.8-6
- Restore use of bcond for python conditionals
* Mon Jul 9 2018 <jdennis@redhat.com> - 0.8-5
- Share same spec file with RHEL