#4 Modernize and generalize building of Python subpackages
Merged 2 years ago by carlwgeorge. Opened 2 years ago by tadej.
rpms/ tadej/uwsgi python-improvements  into  master

file modified
+133 -58
@@ -15,8 +15,9 @@ 

  %bcond_without systemd

  %bcond_without go

  %bcond_without python3

- %bcond_without tornado3

- %{!?python3_pkgversion: %global python3_pkgversion 3}

+ %bcond_without python3_tornado

+ # Fedora doesn't have two versions of python3

+ %bcond_with python3_other

  %bcond_without ruby19

  %bcond_without tuntap

  %bcond_without zeromq
@@ -66,7 +67,8 @@ 

  %bcond_with go

  # el6 doesn't have python3

  %bcond_with python3

- %bcond_with tornado3

+ %bcond_with python3_tornado

+ %bcond_with python3_other

  # el6 ships with ruby 1.8 but fiberloop/rbthreads needs 1.9

  %bcond_with ruby19

  # el6 doesn't have perl-PSGI
@@ -89,9 +91,10 @@ 

  %bcond_without systemd

  # el7 does have python3

  %bcond_without python3

- %{!?python3_pkgversion: %global python3_pkgversion 34}

  # ...but no python3-tornado yet

- %bcond_with tornado3

+ %bcond_with python3_tornado

+ # el 7 has another version of python3

+ %bcond_without python3_other

  # el7 doesn't have zeromq

  %bcond_with zeromq

  # el7 doesn't have greenlet
@@ -124,7 +127,7 @@ 

  

  Name:           uwsgi

  Version:        %{majornumber}.%{minornumber}.%{releasenumber}

- Release:        3%{?dist}

+ Release:        4%{?dist}

  Summary:        Fast, self-healing, application container server

  Group:          System Environment/Daemons

  License:        GPLv2 with exceptions
@@ -156,6 +159,9 @@ 

  %if %{with python3}

  BuildRequires:  python%{python3_pkgversion}-devel

  %endif

+ %if %{with python3_other}

+ BuildRequires:  python%{python3_other_pkgversion}-devel

+ %endif

  %if %{with greenlet}

  BuildRequires:  python-greenlet-devel

  %endif
@@ -261,23 +267,40 @@ 

  This package contains the development header files and libraries

  for uWSGI extensions

  

- %package -n python-uwsgidecorators

- Summary:        Python decorators providing access to the uwsgi API

+ %package -n python2-uwsgidecorators

+ Summary:        Python 2 decorators providing access to the uwsgi API

  Group:          Development/Libraries

  Requires:       %{name} = %{version}-%{release}

- Requires:       %{name}-plugin-python = %{version}-%{release}

+ Requires:       %{name}-plugin-python2 = %{version}-%{release}

+ Obsoletes:      python-uwsgidecorators < 2.0.16-4

  

- %description -n python-uwsgidecorators

- The uwsgidecorators Python module provides higher-level access to the uWSGI API.

+ %description -n python2-uwsgidecorators

+ The uwsgidecorators Python 2 module provides higher-level access to the uWSGI API.

  

- %package -n python3-uwsgidecorators

- Summary:        Python 3 decorators providing access to the uwsgi API

+ %if %{with python3}

+ %package -n python%{python3_pkgversion}-uwsgidecorators

+ Summary:        Python %{python3_version} decorators providing access to the uwsgi API

  Group:          Development/Libraries

  Requires:       %{name} = %{version}-%{release}

- Requires:       %{name}-plugin-python3 = %{version}-%{release}

+ Requires:       %{name}-plugin-python%{python3_pkgversion} = %{version}-%{release}

+ %if 0%{?rhel} == 7

+ Obsoletes:      python3-uwsgidecorators < 2.0.16-4

+ %endif

  

- %description -n python3-uwsgidecorators

- The uwsgidecorators Python 3 module provides higher-level access to the uWSGI API.

+ %description -n python%{python3_pkgversion}-uwsgidecorators

+ The uwsgidecorators Python %{python3_version} module provides higher-level access to the uWSGI API.

+ %endif

+ 

+ %if %{with python3_other}

+ %package -n python%{python3_other_pkgversion}-uwsgidecorators

+ Summary:        Python %{python3_other_version} decorators providing access to the uwsgi API

+ Group:          Development/Libraries

+ Requires:       %{name} = %{version}-%{release}

+ Requires:       %{name}-plugin-python%{python3_other_pkgversion} = %{version}-%{release}

+ 

+ %description -n python%{python3_other_pkgversion}-uwsgidecorators

+ The uwsgidecorators Python %{python3_other_version} module provides higher-level access to the uWSGI API.

+ %endif

  

  %package -n %{name}-docs

  Summary:  uWSGI - Documentation
@@ -629,13 +652,14 @@ 

  %description -n %{name}-plugin-geoip

  This package contains the geoip plugin for uWSGI

  

- %package -n %{name}-plugin-gevent

- Summary:  uWSGI - Plugin for GEvent support

+ %package -n %{name}-plugin-python2-gevent

+ Summary:  uWSGI - Plugin for Python 2 GEvent support

  Group:    System Environment/Daemons

- Requires: %{name}-plugin-python = %{version}-%{release}, libevent

+ Requires: %{name}-plugin-python2 = %{version}-%{release}, libevent

+ Obsoletes: uwsgi-plugin-gevent < 2.0.16-4

  

- %description -n %{name}-plugin-gevent

- This package contains the gevent plugin for uWSGI

+ %description -n %{name}-plugin-python2-gevent

+ This package contains the Python2 gevent plugin for uWSGI

  

  %if %{with glusterfs}

  %package -n %{name}-plugin-glusterfs
@@ -648,13 +672,14 @@ 

  %endif

  

  %if %{with greenlet}

- %package -n %{name}-plugin-greenlet

- Summary:  uWSGI - Plugin for Python Greenlet support

+ %package -n %{name}-plugin-python2-greenlet

+ Summary:  uWSGI - Plugin for Python 2 Greenlet support

  Group:    System Environment/Daemons

- Requires: python-greenlet, %{name}-plugin-python = %{version}-%{release}

+ Requires: python-greenlet, %{name}-plugin-python2 = %{version}-%{release}

+ Obsoletes: uwsgi-plugin-greenlet < 2.0.16-4

  

- %description -n %{name}-plugin-greenlet

- This package contains the python greenlet plugin for uWSGI

+ %description -n %{name}-plugin-python2-greenlet

+ This package contains the Python 2 greenlet plugin for uWSGI

  %endif

  

  %if %{with gridfs}
@@ -756,26 +781,42 @@ 

  %package -n %{name}-plugin-pty

  Summary:  uWSGI - Plugin for PTY support

  Group:    System Environment/Daemons

- Requires: python, %{name}-plugin-common = %{version}-%{release}

+ Requires: python2, %{name}-plugin-common = %{version}-%{release}

  

  %description -n %{name}-plugin-pty

  This package contains the pty plugin for uWSGI

  

- %package -n %{name}-plugin-python

- Summary:  uWSGI - Plugin for Python support

+ %package -n %{name}-plugin-python2

+ Summary:  uWSGI - Plugin for Python 2 support

  Group:    System Environment/Daemons

- Requires: python, %{name}-plugin-common = %{version}-%{release}

+ Requires: python2, %{name}-plugin-common = %{version}-%{release}

+ Obsoletes: uwsgi-plugin-python < 2.0.16-4

  

- %description -n %{name}-plugin-python

- This package contains the python plugin for uWSGI

+ %description -n %{name}-plugin-python2

+ This package contains the Python 2 plugin for uWSGI

  

- %package -n %{name}-plugin-python3

- Summary:  uWSGI - Plugin for Python 3 support

+ %if %{with python3}

+ %package -n %{name}-plugin-python%{python3_pkgversion}

+ Summary:  uWSGI - Plugin for Python %{python3_version} support

  Group:    System Environment/Daemons

  Requires: python%{python3_pkgversion}, %{name}-plugin-common = %{version}-%{release}

+ %if 0%{?rhel} == 7

+ Obsoletes: uwsgi-plugin-python3 < 2.0.16-4

+ %endif

+ 

+ %description -n %{name}-plugin-python%{python3_pkgversion}

+ This package contains the Python %{python3_version} plugin for uWSGI

+ %endif

  

- %description -n %{name}-plugin-python3

- This package contains the Python 3 plugin for uWSGI

+ %if %{with python3_other}

+ %package -n %{name}-plugin-python%{python3_other_pkgversion}

+ Summary:  uWSGI - Plugin for Python %{python3_other_version} support

+ Group:    System Environment/Daemons

+ Requires: python%{python3_other_pkgversion}, %{name}-plugin-common = %{version}-%{release}

+ 

+ %description -n %{name}-plugin-python%{python3_other_pkgversion}

+ This package contains the Python %{python3_other_version} plugin for uWSGI

+ %endif

  

  %package -n %{name}-plugin-rack

  Summary:  uWSGI - Ruby rack plugin
@@ -851,21 +892,27 @@ 

  %description -n %{name}-plugin-ssi

  This package contains the ssi plugin for uWSGI

  

- %package -n %{name}-plugin-tornado

- Summary:  uWSGI - Plugin for Tornado support

+ %package -n %{name}-plugin-python2-tornado

+ Summary:  uWSGI - Plugin for Tornado (Python 2) support

  Group:    System Environment/Daemons

  Requires: %{name}-plugin-common = %{version}-%{release}, python-tornado

+ Obsoletes: uwsgi-plugin-tornado < 2.0.16-4

  

- %description -n %{name}-plugin-tornado

- This package contains the tornado plugin for uWSGI

+ %description -n %{name}-plugin-python2-tornado

+ This package contains the tornado (Python 2) plugin for uWSGI

  

- %package -n %{name}-plugin-tornado3

- Summary:  uWSGI - Plugin for Tornado/Python3 support

+ %if %{with python3_tornado}

+ %package -n %{name}-plugin-python%{python3_pkgversion}-tornado

+ Summary:  uWSGI - Plugin for Tornado (Python %{python3_version}) support

  Group:    System Environment/Daemons

  Requires: %{name}-plugin-common = %{version}-%{release}, python3-tornado

+ %if 0%{?fedora} && 0%{?fedora} < 29

+ Obsoletes: uwsgi-plugin-tornado3 < 2.0.16-4

+ %endif

  

- %description -n %{name}-plugin-tornado3

- This package contains the tornado (python v3) plugin for uWSGI

+ %description -n %{name}-plugin-python%{python3_pkgversion}-tornado

+ This package contains the tornado (Python %{python3_version}) plugin for uWSGI

+ %endif

  

  %package -n %{name}-plugin-ugreen

  Summary:  uWSGI - Plugin for uGreen support
@@ -1169,10 +1216,13 @@ 

  %build

  CFLAGS="%{optflags} -Wno-error -Wno-unused-but-set-variable" python uwsgiconfig.py --build fedora.ini

  %if %{with python3}

- CFLAGS="%{optflags} -Wno-unused-but-set-variable" %{__python3} uwsgiconfig.py --plugin plugins/python fedora python3

- %if %{with tornado3}

- CFLAGS="%{optflags} -Wno-unused-but-set-variable" %{__python3} uwsgiconfig.py --plugin plugins/tornado fedora tornado3

+ CFLAGS="%{optflags} -Wno-unused-but-set-variable" %{__python3} uwsgiconfig.py --plugin plugins/python fedora python%{python3_pkgversion}

+ %if %{with python3_tornado}

+ CFLAGS="%{optflags} -Wno-unused-but-set-variable" %{__python3} uwsgiconfig.py --plugin plugins/tornado fedora python%{python3_pkgversion}_tornado

+ %endif

  %endif

+ %if %{with python3_other}

+ CFLAGS="%{optflags} -Wno-unused-but-set-variable" %{__python3_other} uwsgiconfig.py --plugin plugins/python fedora python%{python3_other_pkgversion}

  %endif

  %if %{with mongodblibs}

  CFLAGS="%{optflags} -Wno-unused-but-set-variable" python uwsgiconfig.py --plugin plugins/mongodblog fedora
@@ -1264,6 +1314,12 @@ 

  %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/

  %endif

  %endif

+ %if %{with python3_other}

+ %{__install} -D -p -m 0644 uwsgidecorators.py %{buildroot}%{python3_other_sitelib}/uwsgidecorators.py

+ %if %{manual_py_compile} == 1

+ %py_byte_compile %{__python3_other} %{buildroot}%{python3_other_sitelib}/

+ %endif

+ %endif

  %if %{with java}

  %{__install} -p -m 0644 plugins/jvm/%{name}.jar %{buildroot}%{_javadir}

  %endif
@@ -1360,16 +1416,22 @@ 

  %{_includedir}/%{name}

  %{_usrsrc}/%{name}

  

- %files -n python-uwsgidecorators

+ %files -n python2-uwsgidecorators

  %defattr(-,root,root,-)

  %{python_sitelib}/*

  

  %if %{with python3}

- %files -n python3-uwsgidecorators

+ %files -n python%{python3_pkgversion}-uwsgidecorators

  %defattr(-,root,root,-)

  %{python3_sitelib}/*

  %endif

  

+ %if %{with python3_other}

+ %files -n python%{python3_other_pkgversion}-uwsgidecorators

+ %defattr(-,root,root,-)

+ %{python3_other_sitelib}/*

+ %endif

+ 

  %files -n %{name}-docs

  %doc docs

  
@@ -1518,7 +1580,7 @@ 

  %files -n %{name}-plugin-geoip

  %{_libdir}/%{name}/geoip_plugin.so

  

- %files -n %{name}-plugin-gevent

+ %files -n %{name}-plugin-python2-gevent

  %{_libdir}/%{name}/gevent_plugin.so

  

  %if %{with glusterfs}
@@ -1527,7 +1589,7 @@ 

  %endif

  

  %if %{with greenlet}

- %files -n %{name}-plugin-greenlet

+ %files -n %{name}-plugin-python2-greenlet

  %{_libdir}/%{name}/greenlet_plugin.so

  %endif

  
@@ -1578,12 +1640,17 @@ 

  %files -n %{name}-plugin-pty

  %{_libdir}/%{name}/pty_plugin.so

  

- %files -n %{name}-plugin-python

+ %files -n %{name}-plugin-python2

  %{_libdir}/%{name}/python_plugin.so

  

  %if %{with python3}

- %files -n %{name}-plugin-python3

- %{_libdir}/%{name}/python3_plugin.so

+ %files -n %{name}-plugin-python%{python3_pkgversion}

+ %{_libdir}/%{name}/python%{python3_pkgversion}_plugin.so

+ %endif

+ 

+ %if %{with python3_other}

+ %files -n %{name}-plugin-python%{python3_other_pkgversion}

+ %{_libdir}/%{name}/python%{python3_other_pkgversion}_plugin.so

  %endif

  

  %files -n %{name}-plugin-rack
@@ -1617,12 +1684,12 @@ 

  %files -n %{name}-plugin-ssi

  %{_libdir}/%{name}/ssi_plugin.so

  

- %files -n %{name}-plugin-tornado

+ %files -n %{name}-plugin-python2-tornado

  %{_libdir}/%{name}/tornado_plugin.so

  

- %if %{with tornado3}

- %files -n %{name}-plugin-tornado3

- %{_libdir}/%{name}/tornado3_plugin.so

+ %if %{with python3_tornado}

+ %files -n %{name}-plugin-python%{python3_pkgversion}-tornado

+ %{_libdir}/%{name}/python%{python3_pkgversion}_tornado_plugin.so

  %endif

  

  %files -n %{name}-plugin-ugreen
@@ -1721,6 +1788,14 @@ 

  

  

  %changelog

+ * Tue Jun 26 2018 Tadej Janež <tadej.j@nez.si> - 2.0.16-4

+ - Modernize and generalize building of Python subpackages:

+   - replace python with python2

+   - use appropriate macros for when refering to Python 3

+   - prefix Python-dependent plugins with the version of Python they are built

+     with

+ - Also build Python 3 subpackages for the other Python 3 version in EPEL7

+ 

  * Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.16-3

  - Rebuilt for Python 3.7

  

This is a bit larger change that tries to modernize and generalize building of Python subpackages. Namely, it:
- Replaces python with python2 in Python 2 subpackage names.
- Uses appropriate macros for when refering to Python 3. I.e. python%{python3_pkgversion} instead of plain python3. This makes the package compatible with EPEL7's Python 3 version(s).
- Prefixes Python-dependent plugins with the version of Python they are built with. E.g., uwsgi-plugin-gevent has been renamed to uwsgi-plugin-python2-gevent. This will allow easier expansion of Python-dependent plugins to all available Python runtimes. E.g., EPEL7 currently provides one Python 2 runtime and two Python 3 runtimes, Python 3.4 and Python 3.6.

The second commit uses the modernized and generalized version of the SPEC file to add support for building uWSGI Python plugin with the other Python 3 version available in EPEL7 (currently, 3.6).

I've added appropriate Obsoletes: where I've renamed the subpackages. I've also searched the EPEL6, EPEL7 and rawhide repositories for packages that would require the renamed subpackages and (besides subpackages in this SPEC file) I've found none.

More Python-related SPEC file modernizations could be made if we would stop supporting EPEL6 with the master branch of the SPEC file. @kad, @carlwgeorge, do you have any opinion on that?

I've also made a Copr with these changes. It builds successfully.

Thank you for your work on this! Sorry for the delay, I've just been busy and was hoping @kad would have time to reply. I'm guessing he was thinking the same thing about me. :D

In general I like these changes. Can you rebase onto the latest master so I can merge it cleanly? Also, please drop the python3_other_* macro definitions, since they are now part of python-rpm-macros thanks to your other pull request (already available in the epel7 buildroot via override).

I don't mind letting the EPEL6 branch diverge, it's getting pretty long in the tooth, but let's wait for @kad's feedback on that.

rebased onto 9054db2

2 years ago

Thank you for your work on this! Sorry for the delay, I've just been busy and was hoping @kad would have time to reply. I'm guessing he was thinking the same thing about me. :D

No problem, I understand. Thanks for reviewing the changes!

In general I like these changes. Can you rebase onto the latest master so I can merge it cleanly? Also, please drop the python3_other_* macro definitions, since they are now part of python-rpm-macros thanks to your other pull request (already available in the epel7 buildroot via override).

Sure, I've updated and rebased the PR.

I don't mind letting the EPEL6 branch diverge, it's getting pretty long in the tooth, but let's wait for @kad's feedback on that.

Ok, agreed.

Pull-Request has been merged by carlwgeorge

2 years ago

@carlwgeorge, could you also fast-forward the epel7 branch to master to include these changes in EPEL7?

Yup, I plan on it. I'm going to try to bump to upstream 2.0.17 first.

Yup, I plan on it. I'm going to try to bump to upstream 2.0.17 first.

Perfect, thanks!