Test py3 MapScript Builds on Travis #6136
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds Python3 building and testing to the Travis Linux CI, using an updated Python MapScript build process.
Python MapScript is tested on Python 2.7 and Python 3.7. msautotest is tested on Python 2.7, 3.6, and 3.7.
Appveyor and the CMake build process now use the
Python_ROOT_DIR
variable rather thanPYTHON_EXECUTABLE
to force a Python version.PYTHON_EXECUTABLE
did not work correctly with Travis in picking up Python directories in initial attempts. In additionPython_ROOT_DIR
is one of the standard HINTs for the FindPython module.From the issue at https://gitlab.kitware.com/cmake/cmake/-/issues/19492:
With the update of the Travis image to Bionic we now have CMake 3.12.
The FindPython CMake module seems to work fine, so there is no longer a need for the previous hacks to work with older versions of CMake. Users wishing to build Python modules can use their default Python or set the
Python_ROOT_DIR
variable to point to a non-default Python installation.Unfortunately the
Python_ROOT_DIR
approach did not work correctly on Travis (FindPython never found the hinted version). I eventually found out it is due to Travis using pyevn to handle the various Python environments. There is a useful introduction to pyenv at Real Python.All msautotest test code now runs under both py2 and py3. One test case was modified to work under py3 (a byte/string issue), and the inbuilt Python server differs between py2 and py3. The remaining code had already been made Python3 compatible thanks to the work by @rouault on updating to pytest.
In summary each of the Travis CI builds now runs the following:
BUILD_NAME=PHP_7.1
- builds and tests Python MapScript for Python 2.7, and msautotest using Python 2.7BUILD_NAME=PHP_7.2_WITH_ASAN
- no Python MapScript is tested in this build, msautotest run using Python 3.6BUILD_NAME=PHP_7.3_WITH_PROJ7
- tests Python MapScript for Python 3.7, and msautotest using Python 3.7Please add any issues, comments, suggestions to this pull request.
@tomkralidis - MapScript for Python 3.7 seems fine on Linux and Windows. It may be worth getting this latest CMake approach, and setting
Python_ROOT_DIR
to point to your Conda install to see if it makes a difference.