Skip to content

Test py3 MapScript Builds on Travis#6136

Merged
geographika merged 14 commits into
MapServer:masterfrom
geographika:travis-py3-ci
Sep 22, 2020
Merged

Test py3 MapScript Builds on Travis#6136
geographika merged 14 commits into
MapServer:masterfrom
geographika:travis-py3-ci

Conversation

@geographika

Copy link
Copy Markdown
Member

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 than PYTHON_EXECUTABLE to force a Python version. PYTHON_EXECUTABLE did not work correctly with Travis in picking up Python directories in initial attempts. In addition Python_ROOT_DIR is one of the standard HINTs for the FindPython module.

From the issue at https://gitlab.kitware.com/cmake/cmake/-/issues/19492:

Overriding Python_EXECUTABLE is not possible to avoid any inconsistency between various components which can be searched for.

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.7
  • BUILD_NAME=PHP_7.2_WITH_ASAN - no Python MapScript is tested in this build, msautotest run using Python 3.6
  • BUILD_NAME=PHP_7.3_WITH_PROJ7 - tests Python MapScript for Python 3.7, and msautotest using Python 3.7

Please 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.

@jmckenna jmckenna added this to the 8.0 Release milestone Sep 15, 2020
@geographika

Copy link
Copy Markdown
Member Author

Does anyone have objections to merging this, or any reservations?
I'll take a look at adding py3,8 support for MapServer 8.0 separately (see #6101). I see there are now PHP 7.4 and 8.0 releases we could add builds for.

@rouault - would it make sense to add the Python dependencies cpp-coveralls pyflakes lxml to msautotest/requirements.txt?
lxml is used for msautotest but not the others, so we could keep them separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants