packages using %python_build on TW broken?
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 ... [ 4s] cycle: libpython3_10-1_0 -> python310-base [ 4s] breaking dependency python310-base -> libpython3_10-1_0 ... [ 9s] [7/138] cumulate python-rpm-macros-20220618.1ed0055-1.1 ... [ 9s] [105/138] cumulate python310-base-3.10.5-2.1 [ 9s] [108/138] cumulate libpython3_10-1_0-3.10.5-2.1 [ 9s] [125/138] cumulate python310-devel-3.10.5-2.1 ... [ 19s] ++ '[' -f _current_flavor ']' [ 19s] ++ true [ 19s] + last_flavor= [ 19s] + '[' -z '' ']' [ 19s] + last_flavor=tmp [ 19s] + '[' tmp '!=' python38 ']' [ 19s] + '[' -d build ']' [ 19s] + '[' -d _build.python38 ']' [ 19s] + echo python38 [ 19s] + python_flavor=python38 [ 19s] + /usr/bin/python3.8 setup.py build '--executable=/usr/bin/python3.8 -s' [ 19s] /var/tmp/rpm-tmp.tD3Phe: line 44: /usr/bin/python3.8: No such file or directory [ 19s] error: Bad exit status from /var/tmp/rpm-tmp.tD3Phe (%build) However, when using %python3_build things start to work: BuildRequires: python-rpm-macros BuildRequires: python3-devel ... %build %python3_build ... [ 4s] cycle: libpython3_10-1_0 -> python310-base [ 4s] breaking dependency python310-base -> libpython3_10-1_0 ... [ 9s] [7/138] cumulate python-rpm-macros-20220618.1ed0055-1.1 ... [ 9s] [105/138] cumulate python310-base-3.10.5-2.1 [ 9s] [108/138] cumulate libpython3_10-1_0-3.10.5-2.1 [ 9s] [125/138] cumulate python310-devel-3.10.5-2.1 ... [ 18s] ++ '[' -f _current_flavor ']' [ 18s] ++ true [ 18s] + last_flavor= [ 18s] + '[' -z '' ']' [ 18s] + last_flavor=tmp [ 18s] + '[' tmp '!=' python3 ']' [ 18s] + '[' -d build ']' [ 18s] + '[' -d _build.python3 ']' [ 18s] + echo python3 [ 18s] + python_flavor=python3 [ 18s] + /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s' But all wiki documentation suggests to use %python_build. Shouldn't all this work automagically? Confused, Manfred
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? 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 [1] https://en.opensuse.org/openSUSE:Packaging_Python
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
Dne 09. 07. 22 v 1:09 Manfred Schwarb napsal(a):
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.
No. %python_build always goes over all available variants, which in 15.3 was python3 (meaning Python 3.6 for SLE-15.*) and python2. On 15.4 python2 was finally removed and it is possible that on future versions of 15.* there will be more variants. That's it. There is no such thing as non-single-spec %python_build. If it worked for you, it is our mistake, for which I sincerely apologize.
But things seem to have changed.
They didn't (at least in 15.*, it is more complicated with SLE 12.* and SLE 11.*, but I don't think you use these).
So for single-spec I need to use %python_subpackages and %python_build, %python_install, %python_sitelib and %python_sitearch (everything python_*)
Yes.
and for non-single-spec I do not use %python_subpackages and use %python3_build, %python3_install, %python3_sitelib and %python3_sitearch (everything python3_*)
Yes.
OK, so far so good. But when in 2 years python4 appears, then ... hmmm [just joking].
Then it will be added into available variants and single-spec should still work (modulo some bugs we will certainly find). If we decide to revive pypi3, jython, or even IronPython, they should still work if we add them to those available Python variants. Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mcepl@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 In those days spirits were brave, the stakes were high, men were real men, women were real women and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri. -- Douglas Adams
Matěj, got it, thanks for your explanation. So no non-single-spec across major python versions, one has to deal with that manually. Cheers, Manfred Am 09.07.22 um 09:13 schrieb Matěj Cepl:
Dne 09. 07. 22 v 1:09 Manfred Schwarb napsal(a):
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.
No. %python_build always goes over all available variants, which in 15.3 was python3 (meaning Python 3.6 for SLE-15.*) and python2. On 15.4 python2 was finally removed and it is possible that on future versions of 15.* there will be more variants. That's it.
There is no such thing as non-single-spec %python_build. If it worked for you, it is our mistake, for which I sincerely apologize.
But things seem to have changed.
They didn't (at least in 15.*, it is more complicated with SLE 12.* and SLE 11.*, but I don't think you use these).
So for single-spec I need to use %python_subpackages and %python_build, %python_install, %python_sitelib and %python_sitearch (everything python_*)
Yes.
and for non-single-spec I do not use %python_subpackages and use %python3_build, %python3_install, %python3_sitelib and %python3_sitearch (everything python3_*)
Yes.
OK, so far so good. But when in 2 years python4 appears, then ... hmmm [just joking].
Then it will be added into available variants and single-spec should still work (modulo some bugs we will certainly find). If we decide to revive pypi3, jython, or even IronPython, they should still work if we add them to those available Python variants.
Best,
Matěj
Dne 10. 07. 22 v 1:09 Manfred Schwarb napsal(a):
So no non-single-spec across major python versions, one has to deal with that manually.
Well, if the package builds with both Python 3.6 and 3.10, it should just work, but yes, that's more and more wild assumption. Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mcepl@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 England is governed not by logic but by parliament. -- Benjamin Disraeli
Dne 08. 07. 22 v 12:19 Manfred Schwarb napsal(a):
BuildRequires: python-rpm-macros BuildRequires: python3-devel ... %build %python_build You are mixing apples and bananas here: you use multi-version %python_subpackages and %python_build with single-version python3- dependencies.
BuildRequires: python3-devel expands in the current Factory to pulling in pyhton310-devel, which means that %python_build trying in one run python3.8 setup.py fails. Either use BuildRequires: %{python_module devel} or %python3_build Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mcepl@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Those to whom evil is done \\ Do evil in return. -- W. H. Auden, September 1, 1939 http://www.poets.org/viewmedia.php/prmMID/15545
participants (3)
-
Ben Greiner
-
Manfred Schwarb
-
Matěj Cepl