Merge lp:~who+dev/inkscape/inkscape-p23 into lp:~inkscape.dev/inkscape/trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~who+dev/inkscape/inkscape-p23 |
Merge into: | lp:~inkscape.dev/inkscape/trunk |
Diff against target: |
231 lines (+43/-25) 6 files modified
share/extensions/bezmisc.py (+25/-11) share/extensions/cspsubdiv.py (+2/-1) share/extensions/inkex.py (+6/-4) share/extensions/simplepath.py (+7/-7) share/extensions/simplestyle.py (+2/-1) share/extensions/simpletransform.py (+1/-1) |
To merge this branch: | bzr merge lp:~who+dev/inkscape/inkscape-p23 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Inkscape Developers | Pending | ||
Review via email: mp+319886@code.launchpad.net |
Commit message
Update certain extensions for compatibility with Python 3.
Description of the change
Summary: Change to several of the core python extension files for compatibility with Python 3. These modifications allow them to continue working in python 2.x, without adding dependencies.
Submitted for code review and possible merging.
The changed files are:
inkex.py
bezmisc.py
cspsubdiv.py
simplepath.py
simplestyle.py
simpletransform.py
In addition to these, I would note that ffgeom.py and cubicsuperpath.py work in both Python 2 and 3 without changes. I have not tested other extension files for compatibility.
These changes appear to be non-breaking within Inkscape, as tested via invoking extensions that depend upon these, including flatten, Voronoi pattern (generate from path), and alphabetsoup. I have tested back to Python 2.6 under Inkscape 0.91, and up to Python 3.6 on the command line. While this is neither a formal test procedure nor exhaustive, I have not observed issues or errors due to these changes. If there are formal tests that could identify other issues, I would certainly welcome learning about them.
One coding note that I have is that the function definitions in bezmisc.py required "manually" unpacking the named tuples on their inputs, which adds one line of code to each function. (It could be approached in other ways, but many of those would break extensions that rely upon this.) Someone more expert at python may know of a more elegant approach. I would welcome such suggestions.
I would assert that making the extension environment compatible with Python 3 is a worthwhile goal, even if we are quite some ways away from making Python 3 compatibility an option or requirement. A good near-term goal is that we encourage extension developers to write code that is compatible with both Python 2 and Python 3. The changes in this branch correct several issues that prevent existing extensions (those that call these "core" files) from running under Python 3.
This set of changes in this branch also potentially allows certain Inkscape extensions to be run from the command line without opening the Inkscape GUI (not otherwise possible for verbs) on systems running either Python 2 or 3 as default.
Unmerged revisions
- 15598. By Windell Oskay
-
changes for compatibility with python 3