#2 Update conditionals
Merged 6 years ago by jorton. Opened 6 years ago by tdawson.
rpms/ tdawson/mod_wsgi update-conditionals  into  master

file modified
+23 -3
@@ -6,15 +6,21 @@ 

  %{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}

  %{!?_httpd_moddir:    %{expand: %%global _httpd_moddir    %%{_libdir}/httpd/modules}}

  

- %if 0%{?fedora} > 12

+ %if 0%{?fedora} || 0%{?rhel} > 7

  %global with_python3 1

  %else

  %global with_python3 0

  %endif

  

+ %if 0%{?fedora} || 0%{?rhel} <= 7

+ %global with_python2 1

+ %else

+ %global with_python2 0

+ %endif

+ 

  Name:           mod_wsgi

  Version:        4.6.2

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        A WSGI interface for Python web applications in Apache

  Group:          System Environment/Libraries

  License:        ASL 2.0
@@ -25,7 +31,7 @@ 

  Patch1: mod_wsgi-4.5.20-exports.patch

  

  BuildRequires:  httpd-devel

- BuildRequires:  python2-sphinx

+ BuildRequires:  python-sphinx

Yet I don't understand this change here. That's the reason this package is still "bad" at http://fedora.portingdb.xyz/namingpolicy/

  BuildRequires:  gcc

  

  # Suppress auto-provides for module DSO
@@ -44,6 +50,7 @@ 

  

  %description %_description

  

+ %if 0%{?with_python2} > 0

  %package -n python2-%{name}

  Summary: %summary

  Requires:       httpd-mmn = %{_httpd_mmn}
@@ -56,6 +63,7 @@ 

  

  %description -n python2-%{name} %_description

  

+ %endif

  

  %if 0%{?with_python3} > 0

  %package -n python3-%{name}
@@ -80,9 +88,12 @@ 

  

  export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}"

  export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"

+ 

+ %if 0%{?with_python2} > 0

  %configure --enable-shared --with-apxs=%{_httpd_apxs}

  make %{?_smp_mflags}

  %py2_build

+ %endif

  

  %if 0%{?with_python3} > 0

  pushd %{py3dir}
@@ -110,6 +121,8 @@ 

  

  %endif

  

+ # second install python2 variant

+ %if 0%{?with_python2} > 0

  make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir}

  

  install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir}
@@ -119,7 +132,9 @@ 

  %py2_install

  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

  %files -n python2-%{name}

  %license LICENSE

  %doc CREDITS.rst README.rst
@@ -129,6 +144,7 @@ 

  %{python2_sitearch}/mod_wsgi

  %{_bindir}/mod_wsgi-express-2

  %{_bindir}/mod_wsgi-express

+ %endif

  

  %if 0%{?with_python3} > 0

  %files -n python3-%{name}
@@ -142,6 +158,10 @@ 

  %endif

  

  %changelog

+ * Thu Mar 22 2018 Troy Dawson <tdawson@redhat.com> - 4.6.2-2

+ - Update conditionals.

+ - Make preperations for non-python2 builds

+ 

  * Tue Mar 13 2018 Matthias Runge <mrunge@redhat.com> - 4.6.2-1

  - update to 4.6.2 (rhbz#1514768)

  - add gcc BR

Update conditionals for newer RHEL's.
Make preperations for non-python2 builds

Thanks Troy!

I think we'd need to add the:

Provides: mod_wsgi = %{version}-%{release}
Provides: mod_wsgi%{?_isa} = %{version}-%{release}

to python3-mod_wsgi for the non-py2 case too, but otherwise lgtm.

Pull-Request has been merged by jorton

6 years ago

Pull request #1 made this use python2 whether you wanted to or not.
This pull request made the package python3 based, with python2 optional.

Yet I don't understand this change here. That's the reason this package is still "bad" at http://fedora.portingdb.xyz/namingpolicy/

I understand what this PR was about. I'm asking why it partially reverted #1.

@churchyard, probably only because it wouldn't build without /usr/bin/sphinx-build. But, fixed in
http://pkgs.fedoraproject.org/rpms/mod_wsgi/c/51a1f91765a9e50401b4d9006eaec8dbd361ff04.

Just a few notes:

  • an assumption that /usr/bin/sphinx-build is in python-sphinx, however reasonable, is invalid (well, it works currently in Fedora, but it's not guaranteed in let's say next major RHEL release)
  • if you need a tool, such as /usr/bin/sphinx-build (i.e. "we don't care for the Python version here, just give me the command"), BuildRequire %{_bindir}/sphinx-build
  • It is dangerous to say "we don't care what Python version the sphinx tool is" in general, because it imports the code and might need the appropriate library versions etc. (however, here it might as well work)
  • doing what @jorton did is the best approach: build the docs with Python 3 explicitly, if you ship Python 3 bits, Python 2 otherwise

BTW you could just put BuildReequires: %{sphinxbin} somewhere at the common section to save yourself one unneeded build dependency (python2-sphinx if python3 is enabled).