Hi Windell,
Am 10.03.2017 um 04:11 schrieb Windell H. Oskay:
I have made minor modifications to several of the supported python extension files for compatibility with Python 3. These modifications allow them to continue working in python 2.x, and do not add dependencies. I am not sure if this is duplicating existing work, but I thought it might be best to discuss it here just in case.
The changed files are: inkex.py bezmisc.py cspsubdiv.py simplepath.py simplestyle.py simpletransform.py
These patches are based on files from 0.92, and which are unchanged in current bzr. I have posted the files here, since I am not an approved Inkscape developer: http://evilmadscientist.com/source/extensionfiles-py2-3.zip (18 kB)
- Just in case your branch/patch hasn't been looked at yet: The usual ways to submit changes to the project, if you're not among those who are allowed to push directly to trunk yet, are (as far as I know from translating the corresponding web pages):
- make a bug report and attach a diff - preferred: create a branch on launchpad (or soon: gitlab) and make a merge request (pull request), asking for feedback
Regards, Maren
(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. Someone more expert at python may know of a more elegant approach.
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 a requirement. This particular set of changes 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.
Thank you all, -Windell
Windell H. Oskay, Ph.D. Co-Founder and Chief Scientist Evil Mad Scientist Laboratories 175 San Lazaro Ave, STE 150 Sunnyvale CA 94086 http://www.evilmadscientist.com/
Windell H. Oskay, Ph.D. Co-Founder and Chief Scientist Evil Mad Scientist Laboratories 175 San Lazaro Ave, STE 150 Sunnyvale CA 94086 http://www.evilmadscientist.com/
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel