Bug 2136842 - system-config-printer fails to build without distutils
Summary: system-config-printer fails to build without distutils
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-printer
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zdenek Dohnal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12
TreeView+ depends on / blocked
 
Reported: 2022-10-21 15:19 UTC by Miro Hrončok
Modified: 2023-07-11 07:29 UTC (History)
3 users (show)

Fixed In Version: system-config-printer-1.5.18-4.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-11 07:02:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2022-10-21 15:19:35 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 in a Copr repository with Python 3.11 sans distutils.

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

system-config-printer fails to build:

https://copr.fedorainfracloud.org/coprs/g/python/python-without-distutils/package/system-config-printer/

--------------------
/usr/bin/python3 setup.py build
Traceback (most recent call last):
  File "/builddir/build/BUILD/system-config-printer-1.5.18/setup.py", line 20, in <module>
    from distutils.core import setup
ModuleNotFoundError: No module named 'distutils'
--------------------

Version-Release number of selected component: 1.5.18-1 


How reproducible: Build system-config-printer without distutils


Steps to Reproduce:
1. fedpkg clone system-config-printer && cd system-config-printer
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/
5. fedpkg mockbuild -N

Actual results: fails to build
Expected results: builds fine


The python3-setutpools package provides a distutils module, so sometimes "simply" adding BuildRequires: python3-setuptools might workaround the problem. Unfortunately,  is not 100 % compatible with the removed standard library one distutils: https://github.com/pypa/setuptools/issues/3532

It appears this package hits one of the incompatibilities, so simply BuildRequiring python3-setuptools does not solve this.

https://copr.fedorainfracloud.org/coprs/g/python/python-without-distutils-always-setuptools/package/system-config-printer/

--------------------
RPM build errors:
    File not found: /builddir/build/BUILDROOT/system-config-printer-1.5.18-1.fc38.x86_64/usr/lib/python3.11/site-packages/cupshelpers
    File not found: /builddir/build/BUILDROOT/system-config-printer-1.5.18-1.fc38.x86_64/usr/lib/python3.11/site-packages/*.egg-info
--------------------

This seems like https://github.com/pypa/setuptools/issues/3143 -- so an actually migration to setuptools or other Python build backend might be required here.

Comment 1 Zdenek Dohnal 2022-10-27 08:11:53 UTC
Hi Miro,

thank you for reporting the issue!

I'll look into the issue and try to migrate the project upstream as well (since I'm upstream there as well).

Comment 2 Tomáš Hrnčiar 2022-12-20 10:48:00 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 system-config-printer with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/python3.12/package/system-config-printer/

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 3 Ben Cotton 2023-02-07 15:10:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 4 Zdenek Dohnal 2023-06-23 09:42:41 UTC
Hi guys,

I've tried to check some tutorials and other Python based projects, but wasn't able to move this one. Can someone from python team help me out?

I'm upstream of the project as well, but I inherited the project and don't know it this deep to change project setup from scratch - so in case you have time, it would be great if you sent me a PR at https://github.com/OpenPrinting/system-config-printer/ .

I'm sorry for not being helpful and thank you in advance!

Comment 5 Miro Hrončok 2023-06-27 09:41:13 UTC
This package hits https://github.com/pypa/setuptools/issues/3143

Replacing:

  setup.py install --prefix=$(DESTDIR)$(prefix)

With:

  setup  .py install --root $(DESTDIR) --prefix=$(prefix)

In Makefile* makes it build.

I won't be able to send upstream PR, because I don't understand autotools and I don't know how to handle unset $DESTDIR.


I've pushed the change into the Fedora package and triggered a build.

Comment 6 Zdenek Dohnal 2023-06-27 09:58:20 UTC
(In reply to Miro Hrončok from comment #5)
> I won't be able to send upstream PR, because I don't understand autotools
> and I don't know how to handle unset $DESTDIR.

Never mind, you've done a lot already, thanks a ton for helping me! I'm sorry for not tackling this sooner.

> 
> 
> I've pushed the change into the Fedora package and triggered a build.

Thanks!

Comment 7 Zdenek Dohnal 2023-07-11 07:02:34 UTC
I can't a bodhi update which brought the fixed build in, but the build exists as https://koji.fedoraproject.org/koji/buildinfo?buildID=2214041 and it is available in current rawhide, so I'm closing the issue as fixed in rawhide.

Comment 8 Miro Hrončok 2023-07-11 07:29:18 UTC
I went through a direct releng-powered old-fashioned side tag merge. Hence, no update in Bodhi ever existed.


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