Bug 2135406 - Packages using /usr/bin/g-ir-scanner will fail to build without distutils
Summary: Packages using /usr/bin/g-ir-scanner will fail to build without distutils
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gobject-introspection
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2154829 (view as bug list)
Depends On:
Blocks: PYTHON3.12 2154816 2154819 2154827
TreeView+ depends on / blocked
 
Reported: 2022-10-17 14:35 UTC by Miro Hrončok
Modified: 2023-06-07 11:07 UTC (History)
16 users (show)

Fixed In Version: gobject-introspection-1.74.0-2.fc38
Clone Of:
Environment:
Last Closed: 2023-06-07 11:06:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNOME Gitlab GNOME gobject-introspection issues 395 0 None opened Drop distutils from gobject-introspection 2022-10-17 14:35:56 UTC

Description Miro Hrončok 2022-10-17 14:35:44 UTC
Description of problem:
The Python standard library distutils module will be removed from Python 3.12+

https://peps.python.org/pep-0632/

As preparatory work, we build all python packages ina  Copr repository with Python 3.11 sans distutils.

https://copr.fedorainfracloud.org/coprs/g/python/python-without-distutils/

Packages, such as anaconda, will fail to build due to:

Traceback (most recent call last):
  File "/usr/bin/g-ir-scanner", line 94, in <module>
    from giscanner.utils import dll_dirs
  File "/usr/lib64/gobject-introspection/giscanner/utils.py", line 355, in <module>
    import distutils.cygwinccompiler
ModuleNotFoundError: No module named 'distutils'

Version-Release number of selected component: 1.74.0-1.fc38


How reproducible: Build anaconda without distutils.


Steps to Reproduce:
1. fedpkg clone anaconda && cd anaconda
2. mock -r fedora-rawhide-x86_64 init
3. mock -r fedora-rawhide-x86_64 install python3-devel
4. sudo rm -rf /var/lib/mock/fedora-rawhide-x86_64/root/usr/lib64/python3.11/distutils/
4. fedpkg mockbuild -N

Actual results:
anaconda faisl to build, ModuleNotFoundError: No module named 'distutils'

Expected results:
anaconda builds fine

Additional info:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/395

Comment 1 Miro Hrončok 2022-10-18 12:32:08 UTC
gobject-introspection itself builds fine, presumably because it has no %check.

Comment 2 Robert Scheck 2022-10-24 23:09:47 UTC
This issue affects the "pluma" RPM package during build-time.

Comment 3 fujiwara 2022-12-20 04:40:51 UTC
g-ir-scanner --compiler=unix option does not help to resolve this issue.

Comment 4 Tomáš Hrnčiar 2022-12-20 10:55:24 UTC
Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.12:
https://copr.fedorainfracloud.org/coprs/python3.12/

Please use this copr for testing rather than https://copr.fedorainfracloud.org/coprs/g/python/python-without-distutils/

If your package is listed in [0], you may workaround this issue by BuildRequiring python-setuptools, note that adding such BuildRequires might however hide some transitive dependency problem, if the distutils import comes from a dependency.
Cooperation with upstream is recommended. Additional context [1].

[0] https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/message/6BHNAWHE7M5VY3YQVJLOYHLY4M7KIFFN/

[1] https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/N6ITYHLRWIDNYNXGPYG2ZHF3ZLQWZN7L/

https://docs.python.org/3.12/whatsnew/3.12.html

For all our attempts to build {PACKAGE} with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/python3.12/package/{PACKAGE}/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 5 Kalev Lember 2022-12-20 11:49:09 UTC
Would it make sense to add 'Requires: python3-setuptools' for now to gobject-introspection-devel as the python scripts shipped there use distutils?

Comment 6 Miro Hrončok 2022-12-20 11:52:23 UTC
I'd probably limit that to:

Requires: (python3-setuptools if python3 >= 3.12)

But yes, that should unblock a lot of packages.

Comment 8 Miro Hrončok 2022-12-20 12:05:42 UTC
Thank you.

Comment 9 Tom "spot" Callaway 2022-12-30 19:30:07 UTC
*** Bug 2154829 has been marked as a duplicate of this bug. ***

Comment 10 Petr Viktorin (pviktori) 2023-06-07 09:18:13 UTC
setuptools internally ends up imports `inspect`, which needs `ast`. When giscanner/ is in PYTHONPATH (as it is in tests), it provides its own top-level `ast.py`, overriding the standard library with an incompatible module. Tests will fail.
Upstream bug: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/429

Comment 11 Petr Viktorin (pviktori) 2023-06-07 10:55:09 UTC
Maybe we can solve this properly upstream. I can also provide a crude patch to unblock the Python 3.12 rebuild in Fedora, if this happens with the Python/setuptools we end up with.

Comment 12 Miro Hrončok 2023-06-07 11:05:30 UTC
If broken, let's keep this open.

Comment 13 David King 2023-06-07 11:06:49 UTC
There is already bug 2208966 open for this (as the test wuite was enabled after this change).


Note You need to log in before you can comment on or make changes to this bug.