Overview

Request 1068072 superseded

Simplify spec file by dropping Python multi-spec and update-alternatives facilities, among other things.


Bjørn Lie's avatar

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


Luciano Santos's avatar
author source maintainer

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.


Dominique Leuenberger's avatar
+%if "%python_version" < "3.11"
+BuildRequires:  python3-tomli
+%endif

OBS won't see this - python_version is only known once the buildroot is setup


Luciano Santos's avatar
author source maintainer

Argh, that's true. %python_version is setup in macros.python_all. Is there an easy way to go about this?


Luciano Santos's avatar
author source maintainer

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)

Dominique Leuenberger's avatar

obs scheduler does not execute %()


Dominique Leuenberger's avatar

BuildRequires: ( python3-tomli if python311-base) ?


Luciano Santos's avatar
author source maintainer

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 ...]).


Luciano Santos's avatar
author source maintainer

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’’’.

Luciano Santos's avatar
author source maintainer

Now it should be Ok after adjusting to python3-foo run-time requirements and manually providing python3-gi-docgen.


Bjørn Lie's avatar

There is no module toml_module tomllib

its called tomli

And I wonder if we should switch to using meson to build this thing See https://build.opensuse.org/package/rdiff/home:iznogood:branches:home:luc14n0:branches:GNOME:Next/python-gi-docgen?opackage=python-gi-docgen&oproject=home%3Aluc14n0%3Abranches%3AGNOME%3ANext&rev=7

We will lose manpages, but we can even req tomli even if toml ends up being used for 3.10


Bjørn Lie's avatar

or is the meson build option only there for usage as sub-project in other projects?


Luciano Santos's avatar
author source maintainer

That's true, I remember figuring that out before but dunno why I used tomlib.


Luciano Santos's avatar
author source maintainer

Ah, I think I remember now. I was in the hope the tomllib module would be added/packaged at some point, I suppose.


OK. I made a mistake, tomllib is provided by Python's 3.11 standard library. I remember figuring this out before but somehow I managed to mess it up :~p

Let me fix it.


Luciano Santos's avatar
author source maintainer

Now, about using Meson. I think I planned to switch it at some point.

And the manpage won't be missed, honestly, due to the nature of gi-docgen being meant for generating API reference docs for GTK and its immediate dependencies.

Request History
Luciano Santos's avatar

luc14n0 created request

Simplify spec file by dropping Python multi-spec and update-alternatives facilities, among other things.


GNOME Review Bot's avatar

gnome-review-bot accepted review

Check script succeeded


GNOME Review Bot's avatar

gnome-review-bot approved review

Check script succeeded


Luciano Santos's avatar

luc14n0 superseded request

superseded by 1078338

openSUSE Build Service is sponsored by