Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test py3 MapScript Builds on Travis #6136

Merged
merged 14 commits into from
Sep 22, 2020

Conversation

geographika
Copy link
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
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.

None yet

2 participants