Add MapScript support for Python 3.x#5561
Conversation
Allows MapScript to build and run against Python 3.4.
The changes appear to continue to work with Python 2.7.
If there are multiple Python versions installed on your machine,
the Python version that is selected is whatever CMake finds first
or the path set with -DPYTHON_EXECUTABLE=
Changes include:
* print "" ---> print("")
* raise E, "text" ---> raise E("text")
* PyString_FromStringAndSize() ---> PyBytes_FromStringAndSize()
* Remove references to PyFile*
|
I've tried this pull request on a Windows machine with Python3. The build is fine when using SWIG 3.0.12. There a few unit test fixes for Python3 syntax, but after making these all but 2 of the tests that pass in Python2 pass in Python3. These are both in the imagetest.py file and relate to writing an image to file. The majority of the tests from this test file also fail in Python3 so the writing of images to file probably needs to be reviewed in depth. Summary - pull request looks good to me - Python MapScript works as well on Python3 as Python2, and there are large parts of the MapScript API to review as several tests and the docs are no longer up-to-date. |
Feel free to make a PR against my branch. |
|
We tested this here at the code sprint in Bonn and agreed that it is fine to merge. It might break Python 2.6 but this is out of maintenance since 2013 anyways. Many thanks for the contribution! |
|
Thanks for merging. I proposed a follow-up with a bunch of test syntax issues in #5572. |
Allows MapScript to build and run against Python 3.4.
The changes appear to continue to work with Python 2.7.
If there are multiple Python versions installed on your machine,
the Python version that is selected is whatever CMake finds first
or the path set with -DPYTHON_EXECUTABLE=
Changes include: