Overview
Request 1078338 superseded
Simplify spec file by dropping Python multi-spec and update-alternatives facilities, among other things.
- Created by luc14n0
- In state superseded
- Supersedes 1068072
- Superseded by 1078831
Are you sure about this:
- Use tomli module buildtime/runtime requirement for Python older
than 3.11. Otherwise, the tomllib module from the standard
library is going to be used instead.
I ask cause when looking at upstream code in meson.build, I'm starting to think that the changes are just wrong.
Please see
https://gitlab.gnome.org/GNOME/gi-docgen/-/blob/main/meson.build
Yes, I am. All that meson.build and pyproject.toml are saying is that if the Python version is less than 3.11 it will fallback to tomli/toml (external modules):
if tomli_version.version_compare('>=1.0') message('Falling back to toml on Python <3.11') else toml_version = run_command( py, '-c', 'import toml; print(toml.__version__)', check: false, ).stdout().strip() if toml_version.version_compare('>=0.10.2') warning('Falling back to deprecated toml module; please update to tomli') else error('tomli 1.0 or newer required on Python 3.10 and older') endif endif
That part of the code is nested inside the IF statement: if py.language_version().version_compare('<3.11')
. So, if Python < 3.11
use the tomli module. And if tomli >= 1.0
(if tomli_version.version_compare('>=1.0')
) use the deprecated toml module.
You can see that if py.language_version().version_compare('<3.11')
has no else statements and that's because in Python 3.11 the tomllib module, that's provided by the standard library, is used instead. Thus there's no need to use additional requirements other than Python 3.11.
+%if "%python_version" < "3.11" +BuildRequires: python3-tomli +%endif
OBS won't see this - python_version is only known once the buildroot is setup
Argh, that's true. %python_version is setup in macros.python_all. Is there an easy way to go about this?
Maybe:
%define have_python311 %(command -v python3.11 >&/dev/null && python3.11 --version | awk '{print $2}')
Or just:
%define have_python311 %(command -v python3.11 >&/dev/null && echo 1)
BuildRequires: ( python3-tomli if python311-base)
?
Oh, boolean deps! Yes, they should work. But we want this instead, to install python3-tomli
when python311-base
is not present: BuldRequires: (python3-tomli unless python311-base)
.
It would be handy if boolean deps could support some from of globbing or versioning, though. Otherwise we're going to have: BuldRequires: (python3-tomli unless python311-base or python312-base [or ...])
.
Ah, unless we'd have a python3-base
meta-package, versioning won't work (even though we can use version with boolean deps).
Note that ‘'’Provides’’’ are not dependencies and ‘'’cannot contain Boolean Expressions’’’.
Request History
luc14n0 created request
Simplify spec file by dropping Python multi-spec and update-alternatives facilities, among other things.
gnome-review-bot accepted review
Check script succeeded
gnome-review-bot approved review
Check script succeeded
superseded by 1078831
Using
unless
boolean dep wasn't the answer too. I went with:And this is the last time I make this much change to a package at once. It's hard to review it. Better use iterations instead.
Switching to Meson does more harm than good for us here. I'm gonna drop it.
OK. I revised the changes I'm doing here and, as long as the package is named
python-gi-docgen
, it's best we keep the single-spec stuff (I misused the term multi-spec before).