Bug 1218143

Summary: python2-pycairo is blocking update python-rpm-macros
Product: [openSUSE] openSUSE Tumbleweed Reporter: Ana Guerrero <ana.guerrero>
Component: PythonAssignee: Python maintainers (group account) <python-maintainers>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: daniel, dimstar, mcepl, mmachova, mrueckert, petr.vorel, petr.vorel, steven.kowalik
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: python2-pycairo_log.txt

Description Ana Guerrero 2023-12-18 08:13:14 UTC
Created attachment 871412 [details]
python2-pycairo_log.txt

python-rpm-macros 20231204.dd64e74 (SR#1130671) is blocked by python2-pycairo failing to build.

Most relevant part of the build log (attached):

[   12s] + xargs -0 /usr/bin/python2 -c ' 
[   12s] import sys, py_compile 
[   12s] for f in sys.argv[1:]: 
[   12s]   fp=f[len("/home/abuild/rpmbuild/BUILDROOT/python2-pycairo-1.18.1-6.20.x86_64"):] 
[   12s]   print(f"Generating cached byte-code for {fp}") 
[   12s]   for o in [0, 1]: 
[   12s]     py_compile.compile(f, dfile=fp, optimize=o) 
[   12s] '
[   12s]   File "<string>", line 5
[   12s]     print(f"Generating cached byte-code for {fp}") 
[   12s]                                                 ^
[   12s] SyntaxError: invalid syntax
[   12s] error: Bad exit status from /var/tmp/rpm-tmp.LYEGW2 (%install)


This seems to be using f-strings in python2.7 where they are not yet supported.
The last update of python2-pycairo is from March 2020, so I'm wondering if this package is still maintained by upsteam. However, gimp, python-gobject2, python-gtk have a direct dependency on this package.
Comment 1 Markéta Machová 2023-12-19 09:55:23 UTC
This code actually comes from python-rpm-macros, where it was already fixed upstream: https://github.com/openSUSE/python-rpm-macros/pull/167.

pytho2-pycairo is by name the python2 compatible version of python-pycairo, which is alive. At the time it was probably a good decision to fork it. Wow, I didn't know we have so many python2-only packages still in our distro, even gimp. Maybe we could take a look whether they still need python2 and modernize them at some point.
Comment 2 Ana Guerrero 2023-12-19 15:16:37 UTC
Looks like it needs further fixing:

[   13s] + find /home/abuild/rpmbuild/BUILDROOT/python2-pycairo-1.18.1-6.57.x86_64/usr/lib64/python2.7/site-packages -iname '*.pyc' -delete
[   13s] + find /home/abuild/rpmbuild/BUILDROOT/python2-pycairo-1.18.1-6.57.x86_64/usr/lib64/python2.7/site-packages -iname '*.py' -print0
[   13s] + xargs -0 /usr/bin/python2 -c ' 
[   13s] import sys, py_compile 
[   13s] for f in sys.argv[1:]: 
[   13s]   fp=f[len("/home/abuild/rpmbuild/BUILDROOT/python2-pycairo-1.18.1-6.57.x86_64"):] 
[   13s]   print("Generating cached byte-code for " + str(fp)) 
[   13s]   for o in [0, 1]: 
[   13s]     py_compile.compile(f, dfile=fp, optimize=o) 
[   13s] '
[   13s] Generating cached byte-code for /usr/lib64/python2.7/site-packages/cairo/__init__.py
[   13s] Traceback (most recent call last):
[   13s]   File "<string>", line 7, in <module>
[   13s] TypeError: compile() got an unexpected keyword argument 'optimize'
[   13s] error: Bad exit status from /var/tmp/rpm-tmp.JyEZik (%install)
[   13s]
Comment 3 Steve Kowalik 2023-12-21 02:42:37 UTC
GIMP is firmly Python 2 until GIMP 3.0 releases. So we're stuck with python2-pycairo, and pygtk and a few others I forget until it does.
Comment 4 Matej Cepl 2023-12-22 19:18:45 UTC
(In reply to Steve Kowalik from comment #3)
> GIMP is firmly Python 2 until GIMP 3.0 releases. So we're stuck with
> python2-pycairo, and pygtk and a few others I forget until it does.

Wouldn't it be better to enable gimp pre-3.0 in Factory? https://build.opensuse.org/package/show/graphics:gimp:master/gimp looks like something real.

Adding all involved into Cc: of this bug.
Comment 5 Matej Cepl 2023-12-22 19:21:24 UTC
Could I ask about the current status of GIMP (2.99.16+git839.adb8f9dcb)? Wouldn’t it be possible to replace the stable gimp in Factory with this? What remains to be done?
Comment 6 Matej Cepl 2023-12-22 19:21:50 UTC
https://www.gimp.org/downloads/devel/
Comment 7 Petr Vorel 2023-12-26 14:19:18 UTC
(In reply to Matej Cepl from comment #5)
> Could I ask about the current status of GIMP (2.99.16+git839.adb8f9dcb)?
> Wouldn’t it be possible to replace the stable gimp in Factory with this?
> What remains to be done?

I don't think it's a good idea to remove stable GIMP from Tumbleweed. Although GIMP from master branch mostly works, IMHO Tumbleweed users deserve stable GIMP.

FYI I tried to fix some of GIMP from master branch, but I'm not the main packager.
Comment 8 Marcus Rückert 2024-01-09 11:23:31 UTC
we have gimp master packages in the OBS already.

https://build.opensuse.org/project/show/graphics:gimp:master

but they also often require the master version of babl and gegl. not sure if we also want to bump those in TW all the time.

But I mean we are lucky and gimp 3 will probably be released in 2024.
Comment 9 Matej Cepl 2024-01-09 13:38:31 UTC
(In reply to Marcus Rückert from comment #8)
> we have gimp master packages in the OBS already.
> 
> https://build.opensuse.org/project/show/graphics:gimp:master
> 
> but they also often require the master version of babl and gegl. not sure if
> we also want to bump those in TW all the time.
> 
> But I mean we are lucky and gimp 3 will probably be released in 2024.

Does it mean that we can finally kill Python 2 in Factory?
Comment 10 Marcus Rückert 2024-01-09 13:45:45 UTC
if gimp really is the last thing sitting on it. then yes 2024 might become your lucky year.
Comment 11 Marcus Rückert 2024-01-09 15:13:18 UTC
discussion about preparing for gimp3 is now tracked here https://bugzilla.suse.com/show_bug.cgi?id=1218653
Comment 12 Dominique Leuenberger 2024-02-08 16:26:23 UTC
(In reply to Markéta Machová from comment #1)
> This code actually comes from python-rpm-macros, where it was already fixed
> upstream: https://github.com/openSUSE/python-rpm-macros/pull/167.
> 
> pytho2-pycairo is by name the python2 compatible version of python-pycairo,
> which is alive. At the time it was probably a good decision to fork it. Wow,
> I didn't know we have so many python2-only packages still in our distro,
> even gimp. Maybe we could take a look whether they still need python2 and
> modernize them at some point.

py2 drop tracked at https://bugzilla.opensuse.org/show_bug.cgi?id=1219306

As for this bug, as far as I can see: nothing left. the python-rpm-macros have been fixed to not break py2 packages,