From Fedora Project Wiki
(request-repo)
(Update, add script)
 
(One intermediate revision by the same user 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
== Issues ==
and using that macro where possible.
* How to handle %{py3_dist} macro?
* No need for the %python_provide macro, although it shouldn't hurt
* Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}
* Must change %{py3_dist} to %{py3X_dist}  
* Must change python3dist to python3.Xdist


== Modules ==
== Modules ==
* where in Fedora, a module has python3-foo subpackage, in EPEL the subpackage must be python3X-foo.
* where in Fedora, a module has python3-foo subpackage, in EPEL the subpackage must be python3X-foo.
* Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}
 
== Example conversion script ==
 
<pre>
#!/bin/bash
 
sed -i.orig -e '1,/%changelog/s/python3-/python%{python3_pkgversion}-/g' \
            -e '1,/%changelog/s/%{py3_dist /%{py38_dist /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
</pre>


== 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 52:


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 75:


%check
%check
%{__python3} setup.py test
%{__python3} -m pytest -v .


%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 23:55, 24 May 2022

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, although it shouldn't hurt
  • Any files in %{_bindir} must only be of the form %{_bindir}/foo-%{python3_version}
  • Must change %{py3_dist} to %{py3X_dist}
  • Must change python3dist to python3.Xdist

Modules

  • where in Fedora, a module has python3-foo subpackage, in EPEL the subpackage must be python3X-foo.

Example conversion script

#!/bin/bash

sed -i.orig -e '1,/%changelog/s/python3-/python%{python3_pkgversion}-/g' \
            -e '1,/%changelog/s/%{py3_dist /%{py38_dist /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
%{__python3} -m pytest -v .

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

%changelog