Ben, thanks for your advice, it's appreciated. Am 08.07.22 um 21:14 schrieb Ben Greiner:
Hi,
Am 08.07.22 um 12:19 schrieb Manfred Schwarb:
Hi,
I wanted to compile a very simple python package, producing a single python executable:
BuildRequires: python-rpm-macros BuildRequires: python3-devel ... %build %python_build
But all wiki documentation suggests to use %python_build. Shouldn't all this work automagically?
The Wiki page [1] is very elaborate about it. Do you have any suggestion where it could be clearer?
Well, the command %python3_build does not appear on this page. Up to now, I was thinking that %python_subpackages is the switch between single-spec and non-single-spec, and everything else adjusts magically. Up to recently, there was also python2 available, so using %python3_build to get the default python non-single-spec variant was clearly wrong. I mean, on Leap 15.3 python 2.7 is still the default. So I guessed that for single-spec %python_build iterates over all available python2 and python3 variants, and for non-single-spec %python_build uses just the default python variant, be it python2 or python3. But things seem to have changed. So for single-spec I need to use %python_subpackages and %python_build, %python_install, %python_sitelib and %python_sitearch (everything python_*) and for non-single-spec I do not use %python_subpackages and use %python3_build, %python3_install, %python3_sitelib and %python3_sitearch (everything python3_*) OK, so far so good. But when in 2 years python4 appears, then ... hmmm [just joking]. Cheers, Manfred
You have two options:
A) single-spec for multiple flavors
BuildRequires: python-rpm-macros BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} %python_subpackages
... %build %python_build
B) not single-spec, only one flavor (python3 == python310 currently)
BuildRequires: python-rpm-macros BuildRequires: python3-devel BuildRequires: python3-setuptools ... %build %python3_build
Do NOT mix the two. The %python_build in your specfile wants to call `python3.X setup.py build` for all the flavors in the buildset but only has python3-devel installed. (And you only need -devel, i.e. the headers, if setup.py defines extensions in C or Fortran code to be compiled and linked to the python libs).
- Ben