FS#62180 - [inkscape] support for python3

Attached to Project: Arch Linux
Opened by Adam Fontenot (amfontenot) - Friday, 29 March 2019, 03:01 GMT
Last edited by Gaetan Bisson (vesath) - Tuesday, 16 April 2019, 23:26 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

This package as of 0.92.4-4 currently requires python2, which I've just purged from my system. I'm slowly adding back some of the stuff I removed in the process to see what actually requires it.

From what I have been able to determine, Inkscape does not require Python 2 to run. At one point, its extensions did, but this seems to have changed: their extensions repository now claims to support Python 3 including full test coverage. https://gitlab.com/inkscape/extensions/blob/master/README.md

In light of this, the patching in the inkscape PKGBUILD to make it run on Python 2 seems now to be undesirable. Either the package should be rebuilt to use Python 3, or a patch to fall back to Python 3 in case Python 2 is not available should be used instead. It would be great if python2 could be moved to optdepends.

Thanks!
This task depends upon

Closed by  Gaetan Bisson (vesath)
Tuesday, 16 April 2019, 23:26 GMT
Reason for closing:  Upstream
Comment by Gaetan Bisson (vesath) - Sunday, 14 April 2019, 21:09 GMT
The python2-free claim probably applies to the master branch. Our package uses the latest stable release. On my system, I've got:

$ grep python2 `pacman -Qlq inkscape` 2>/dev/null | wc -l
168

So quite a few things apparently still rely on python2. Cheers.
Comment by Jannik Vogel (JayFoxRox) - Sunday, 14 April 2019, 21:49 GMT
This is possibly self-inflicted by the PKGBUILD: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/inkscape#n31

If you grep for python2 in the 0.92.4 source code, you only find Python 2 for macOS and Windows / part of buildsystem (?) - and that's probably optional. If you grep in the share/ folder for inkscape, there's not a single mention of python2. All scripts use a `#!/usr/bin/env python` shebang, which implies Python 3 support.
(Edit: This paragraph is wrong! python implies python2, not python3)

However, according to the wiki, extensions using a certain file were still broken: inkex.py (Also see: http://wiki.inkscape.org/wiki/index.php/Extension_Interpreters#Selecting_a_specific_interpreter_version_.28via_preferences_file.29 ). That was only fixed 1 month ago (See https://gitlab.com/inkscape/inkscape/merge_requests/568 ), and is not fixed in the current stable version.

The extensions repo linked above appears to be used for future major versions (and is also Python 3 compatible).

So on the next update (either 1.0 or 0.92.5) this package can probably be (safely) migrated to Python 3.
Even now, it could probably be migrated to Python 3, with optional Python 2 for certain extensions.
Comment by loqs (loqs) - Sunday, 14 April 2019, 22:49 GMT
From https://gitlab.com/inkscape/inkscape/merge_requests/568/diffs 109 .py files were changed for python3 compatibility excluding the unshipped share/extensions/test/render_barcode.test.py
that leaves 108 of the 188 .py files shipped by inkscape affected.
Edit:
https://www.python.org/dev/peps/pep-0394/ covers the interpretation of /usr/bin/env python
Comment by Gaetan Bisson (vesath) - Monday, 15 April 2019, 02:32 GMT
You're correct!

I remember introducing those sed lines in the PKGBUILD because, as you point out, many scripts using `#!/usr/bin/env python` expect python2. I'm glad to hear those scripts have since been ported to python3 upstream and look forward to deprecating python2 as soon as an upstream release supports it. For now I think having python3 for most scripts and python2 in optdepends would introduce too much additional complexity for too little gain. Cheers.
Comment by Adam Fontenot (amfontenot) - Tuesday, 16 April 2019, 08:23 GMT
> that leaves 108 of the 188 .py files shipped by inkscape affected.

My understanding is that while only a minority of extensions were modified in that diff, those that were not were already compatible with Python 3. I could be wrong about this but we could always check with upstream about the status of their Python 3 conversion before making any changes here. If I'm correct about this, we should be good to go as soon as a release with #568 lands. (When I posted this bug report, I mistakenly believed it had already landed since Arch has a release of Inkscape that postdates its merge into the 0.92.x branch.)
Comment by loqs (loqs) - Tuesday, 16 April 2019, 11:47 GMT
That was what I was intending to convey 80 of the 188 python extension files are python 3 compatible as they are not touched by 568.
Comment by Gaetan Bisson (vesath) - Tuesday, 16 April 2019, 23:26 GMT
Thank you for your detailed explanations. We will now wait for the next upstream release. Feel free to mark the package as out-of-date with a note on python3 support when it comes out. Cheers.

Loading...