Skip to content

Commit

Permalink
Add py37 MapScript build and testing (#6107)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent d35b287 commit 79652b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
14 changes: 12 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cache:
environment:

global:
SWIG_VER: swigwin-4.0.1
TWINE_USERNAME: mapserver
TWINE_PASSWORD:
secure: mHoJHeXdXbBNoDf7MA4ZEg==
Expand All @@ -24,10 +25,10 @@ environment:
SWIG_VER: swigwin-3.0.12
- platform: x64
PYTHON_EXECUTABLE: c:/python27-x64/python.exe
SWIG_VER: swigwin-4.0.1
- platform: x64
PYTHON_EXECUTABLE: c:/python36-x64/python.exe
SWIG_VER: swigwin-4.0.1
- platform: x64
PYTHON_EXECUTABLE: c:/python37-x64/python.exe

services:
- mssql2017
Expand All @@ -38,6 +39,15 @@ matrix:
shallow_clone: false
clone_depth: 5

init:
- ps: |
if ($env:APPVEYOR_REPO_TAG -ne $TRUE) {
if ("c:/python27-x64/python.exe","c:/python36-x64/python.exe" -contains $env:PYTHON_EXECUTABLE -eq $TRUE) {
Write-Host "Skipping build, not a tagged release."
Exit-AppVeyorBuild
}
}
build_script:
- set "BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER:\=/%"
- if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64
Expand Down
4 changes: 3 additions & 1 deletion mapscript/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ add_custom_command(
DEPENDS mapscriptwheel.stamp
OUTPUT mapscripttests.stamp
COMMAND ${PYTHON_VENV_SCRIPTS}/pip install --no-index --find-links=${OUTPUT_FOLDER}/dist mapscript
COMMAND ${PYTHON_VENV_SCRIPTS}/pytest --pyargs mapscript.tests
# ERROR: file or package not found: mapscript.tests (missing __init__.py?) is caused by
# ImportError: DLL load failed while importing _mapscript: The specified module could not be found.
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m pytest --pyargs mapscript.tests
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.project_csv ${PROJECT_SOURCE_DIR}/tests/cities.csv 2 1 EPSG:4326 EPSG:3857 > test.csv
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.shpdump ${PROJECT_SOURCE_DIR}/tests/polygon.shp > shpdump.txt
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.shpinfo ${PROJECT_SOURCE_DIR}/tests/polygon.shp > shpinfo.txt
Expand Down
6 changes: 4 additions & 2 deletions mapscript/python/pymodule.i
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ CreateTupleFromDoubleArray( double *first, unsigned int size ) {
PyObject* val = PyList_GetItem(values, i);

%#if PY_MAJOR_VERSION >= 3
$1[i] = PyUnicode_AsUTF8(key);
$2[i] = PyUnicode_AsUTF8(val);
// Changed in version 3.7: The return type is now const char * rather than char *
// avoid warning C4090: '=': different 'const' qualifiers
$1[i] = (char *)PyUnicode_AsUTF8(key);
$2[i] = (char *)PyUnicode_AsUTF8(val);
%#else
$1[i] = PyString_AsString(key);
$2[i] = PyString_AsString(val);
Expand Down

0 comments on commit 79652b1

Please sign in to comment.