From Fedora Project Wiki
(request-repo)
(Remove vestigial reference to %py3X_dist)
 
(6 intermediate revisions by 2 users not shown)
Line 3: Line 3:


= Python 3X applications and modules in EPEL 8 =
= Python 3X applications and modules in EPEL 8 =
Since Python minor version are not ABI compatible and because EPEL guidelines strongly discourage breaking ABI compatibility, separate Python 3 minor versions in EPEL 8 are packaged as separate python3X (currently python38) packages to allow for independent versions for each Python version.  These guidelines are for building modules for the non-primary version(s) of Python in RHEL 8.
Since Python minor version are not ABI compatible and because EPEL guidelines strongly discourage breaking ABI compatibility, separate Python 3 minor versions in EPEL 8 are packaged as separate python3X (currently python38 or python39) packages to allow for independent versions for each Python version.  These guidelines are for building modules for the non-primary version(s) of Python in RHEL 8.


New repos for existing Python modules packaged for Fedora can be requested without the need for a new review with:
New repos for existing Python modules packaged for Fedora can be requested without the need for a new review with:
  fedpkg request-repo --exception python38-foo
  fedpkg request-repo --exception python38-foo-epel


== All Packages ==
== All Packages ==


* Must override the __python3 macro, e.g.:
* When building locally, you must make sure the proper python3X-rpm-macros package is installed, or you can override the __python3 macro, e.g.:
  %global __python3 /usr/bin/python3.8
  %global __python3 /usr/bin/python3.8
* No need for the %python_provide macro
* Suggest adding:
%global python3_pkgversion 38
and using that macro where possible.
* No need for the %python_provide macro. It's deprecated and is noop here.
* Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}
* %{py3_dist ...} can be kept as is. The macro will determine the appropriate value based on %python3_pkgversion.
* Must change python3dist to python3.Xdist
 
== Example conversion script ==
 
<pre>
#!/bin/bash


== Issues ==
sed -i.orig -e '1,/%changelog/s/python3-/python%{python3_pkgversion}-/g' \
* How to handle %{py3_dist} macro?
            -e '1,/%changelog/s/python3dist(/python3.8dist(/g' \
            -e '/^Name:/s/python-\(.*\)/python%{python3_pkgversion}-\1-epel/' \
            -e '1i%global python3_pkgversion 38' $1


== Modules ==
mv $1 $(basename ${1/python-/python38-} .spec)-epel.spec
* where in Fedora, a module has python3-foo subpackage, in EPEL the subpackage must be python3X-foo.
</pre>
* Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}


== Example Spec ==
== Example Spec ==


<pre>
<pre>
%global python3_pkgversion 38
%global srcname example
%global srcname example
%global sum An example python module
%global __python3 /usr/bin/python3.8


Name:          python38-%{srcname}
Name:          python%{python3_pkgversion}-%{srcname}-epel
Version:        1.2.3
Version:        1.2.3
Release:        1%{?dist}
Release:        1%{?dist}
Summary:        %{sum}
Summary:        An example Python module
License:        MIT
License:        MIT
URL:            https://pypi.python.org/pypi/%{srcname}
URL:            https://pypi.python.org/pypi/%{srcname}
Line 37: Line 48:


BuildArch:      noarch
BuildArch:      noarch
BuildRequires:  python38-devel
BuildRequires:  python38-othermodule
Requires:      python38-othermodule


%description
%description
An python module which provides a convenient example.
A python module which provides a convenient example.
 
%package -n python%{python3_pkgversion}-%{srcname}
Summary:        An example Python module
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-othermodule
Requires:      python%{python3_pkgversion}-othermodule
 
%description -n python%{python3_pkgversion}-%{srcname}
A python module which provides a convenient example.


%prep
%prep
Line 54: Line 71:


%check
%check
%{__python3} setup.py test
%pytest


%files
%files -n python%{python3_pkgverision}-%{srcname}
%license COPYING
%license COPYING
%doc README.rst
%doc README.rst
%{python3_sitelib}/*
%{_bindir}/sample-exec-%{python3_version}
%{_bindir}/sample-exec-%{python3_version}
%{python3_sitelib}/%{srcname}/


%changelog
%changelog
</pre>
</pre>

Latest revision as of 00:33, 24 January 2023

DRAFT

This is a work in progress

Python 3X applications and modules in EPEL 8

Since Python minor version are not ABI compatible and because EPEL guidelines strongly discourage breaking ABI compatibility, separate Python 3 minor versions in EPEL 8 are packaged as separate python3X (currently python38 or python39) packages to allow for independent versions for each Python version. These guidelines are for building modules for the non-primary version(s) of Python in RHEL 8.

New repos for existing Python modules packaged for Fedora can be requested without the need for a new review with:

fedpkg request-repo --exception python38-foo-epel

All Packages

  • When building locally, you must make sure the proper python3X-rpm-macros package is installed, or you can override the __python3 macro, e.g.:
%global __python3 /usr/bin/python3.8
  • Suggest adding:
%global python3_pkgversion 38

and using that macro where possible.

  • No need for the %python_provide macro. It's deprecated and is noop here.
  • Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}
  • %{py3_dist ...} can be kept as is. The macro will determine the appropriate value based on %python3_pkgversion.
  • Must change python3dist to python3.Xdist

Example conversion script

#!/bin/bash

sed -i.orig -e '1,/%changelog/s/python3-/python%{python3_pkgversion}-/g' \
            -e '1,/%changelog/s/python3dist(/python3.8dist(/g' \
            -e '/^Name:/s/python-\(.*\)/python%{python3_pkgversion}-\1-epel/' \
            -e '1i%global python3_pkgversion 38' $1

mv $1 $(basename ${1/python-/python38-} .spec)-epel.spec

Example Spec

%global python3_pkgversion 38
%global srcname example

Name:           python%{python3_pkgversion}-%{srcname}-epel
Version:        1.2.3
Release:        1%{?dist}
Summary:        An example Python module
License:        MIT
URL:            https://pypi.python.org/pypi/%{srcname}
Source0:        %{pypi_source}

BuildArch:      noarch

%description
A python module which provides a convenient example.

%package -n python%{python3_pkgversion}-%{srcname}
Summary:        An example Python module
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-othermodule
Requires:       python%{python3_pkgversion}-othermodule

%description -n python%{python3_pkgversion}-%{srcname}
A python module which provides a convenient example.

%prep
%autosetup -n %{srcname}-%{version}

%build
%py3_build

%install
%py3_install

%check
%pytest

%files -n python%{python3_pkgverision}-%{srcname}
%license COPYING
%doc README.rst
%{_bindir}/sample-exec-%{python3_version}
%{python3_sitelib}/%{srcname}/

%changelog