From 3defd579d39b6714244969c8c6265ef38f7b407c Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Nov 18 2019 11:51:18 +0000 Subject: Switch conditions from %global to %bcond --- diff --git a/mod_wsgi.spec b/mod_wsgi.spec index 6041819..3fdd8c6 100644 --- a/mod_wsgi.spec +++ b/mod_wsgi.spec @@ -7,15 +7,15 @@ %{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} %if 0%{?fedora} || 0%{?rhel} > 7 -%global with_python3 1 +%bcond_without python3 %else -%global with_python3 0 +%bcond_with python3 %endif %if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7) -%global with_python2 1 +%bcond_without python2 %else -%global with_python2 0 +%bcond_with python2 %global debug_package %{nil} %endif @@ -47,7 +47,7 @@ existing WSGI adapters for mod_python or CGI.\ %description %_description -%if 0%{?with_python2} > 0 +%if %{with python2} %package -n python2-%{name} Summary: %summary Requires: httpd-mmn = %{_httpd_mmn} @@ -62,12 +62,12 @@ Obsoletes: mod_wsgi < %{version}-%{release} %endif -%if 0%{?with_python3} > 0 +%if %{with python3} %package -n python3-%{name} Summary: %summary Requires: httpd-mmn = %{_httpd_mmn} BuildRequires: python3-devel, python3-sphinx, python3-sphinx_rtd_theme -%if 0%{?with_python2} == 0 +%if !%{with python2} Provides: mod_wsgi = %{version}-%{release} Provides: mod_wsgi%{?_isa} = %{version}-%{release} Obsoletes: mod_wsgi < %{version}-%{release} @@ -83,14 +83,14 @@ Obsoletes: mod_wsgi < %{version}-%{release} : Python2=%{with_python2} Python3=%{with_python3} %build -%if %{with_python3} +%if %{with python3} make -C docs html SPHINXBUILD=%{_bindir}/sphinx-build-3 %endif export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}" export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" -%if 0%{?with_python3} > 0 +%if %{with python3} mkdir py3build/ # this always produces an error (because of trying to copy py3build # into itself) but we don't mind, so || : @@ -102,7 +102,7 @@ make %{?_smp_mflags} popd %endif -%if 0%{?with_python2} > 0 +%if %{with python2} %configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=python2 make %{?_smp_mflags} %py2_build @@ -110,7 +110,7 @@ make %{?_smp_mflags} %install # first install python3 variant and rename the so file -%if 0%{?with_python3} > 0 +%if %{with python3} pushd py3build make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} mv $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi{,_python3}.so @@ -126,7 +126,7 @@ popd %endif # second install python2 variant -%if 0%{?with_python2} > 0 +%if %{with python2} make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} @@ -138,7 +138,7 @@ mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express{,-2} ln -s %{_bindir}/mod_wsgi-express-2 $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express %endif -%if 0%{?with_python2} > 0 +%if %{with python2} %files -n python2-%{name} %license LICENSE %doc CREDITS.rst README.rst @@ -150,7 +150,7 @@ ln -s %{_bindir}/mod_wsgi-express-2 $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express %{_bindir}/mod_wsgi-express %endif -%if 0%{?with_python3} > 0 +%if %{with python3} %files -n python3-%{name} %license LICENSE %doc CREDITS.rst README.rst