openSUSE / python-rpm-macros

Multi-Python, Single-Spec macros generator
Other
22 stars 20 forks source link

Allow packaging of sle15_python_module_pythons but with primary on Tumbleweed #173

Closed tacerus closed 1 month ago

tacerus commented 6 months ago

Hi,

currently it seems common to pin software which is not compatible with the system Python on SLE to Python 3.11. However often the software is only having a dependency of "anything higher than 3.6", meaning it would work well with whatever primary Python Tumbleweed is currently using. It would be nice to have some macros which allow adding a Python version suffix to binaries (for example "foo-3.11") on SLE, but keeping suffixless binaries (just "foo", in this example) on Tumbleweed to avoid pinning Python versions where no pinning would be needed.

Hope I explained this well.

bnavigator commented 6 months ago

%{?sle15_python_module_pythons} only has an effect on Leap/SLE. It is not defined in Tumbleweed and does not pin anything to Python 3.11 there. Tumbleweed has single-spec multiflavor. The Leap/SLE "abuses" this multiflavor concept to force a single flavor as member of the multiflavor build set.

bnavigator commented 6 months ago

If you really want to restrict Tumbleweed packages to one package with current primary, you do

%if 0%{?suse_version} > 1500
%define pythons python3
%else
%{?sle15_python_module_pythons}
%endif

Name: python-foo
...
%python_subpackages

...

which will create python3-foo for Tumbleweed.

Or instead of python3, use %define pythons %{primary_python} which will create python311-foo for Tumbleweed, but not python310-foo or python312-foo