Skip to content

Commit b38c7eb

Browse files
authored
Add py37 MapScript build and testing (MapServer#6100)
* Add py37 MapScript testing * Fix comment typo
1 parent 008877f commit b38c7eb

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

appveyor.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cache:
1212
environment:
1313

1414
global:
15+
SWIG_VER: swigwin-4.0.1
1516
TWINE_USERNAME: mapserver
1617
TWINE_PASSWORD:
1718
secure: mHoJHeXdXbBNoDf7MA4ZEg==
@@ -24,10 +25,10 @@ environment:
2425
SWIG_VER: swigwin-3.0.12
2526
- platform: x64
2627
PYTHON_EXECUTABLE: c:/python27-x64/python.exe
27-
SWIG_VER: swigwin-4.0.1
2828
- platform: x64
2929
PYTHON_EXECUTABLE: c:/python36-x64/python.exe
30-
SWIG_VER: swigwin-4.0.1
30+
- platform: x64
31+
PYTHON_EXECUTABLE: c:/python37-x64/python.exe
3132

3233
services:
3334
- mssql2017
@@ -38,6 +39,15 @@ matrix:
3839
shallow_clone: false
3940
clone_depth: 5
4041

42+
init:
43+
- ps: |
44+
if ($env:APPVEYOR_REPO_TAG -ne $TRUE) {
45+
if ("c:/python27-x64/python.exe","c:/python36-x64/python.exe" -contains $env:PYTHON_EXECUTABLE -eq $TRUE) {
46+
Write-Host "Skipping build, not a tagged release."
47+
Exit-AppVeyorBuild
48+
}
49+
}
50+
4151
build_script:
4252
- ps: Write-Host "Build tags - $env:APPVEYOR_REPO_TAG $env:APPVEYOR_REPO_TAG_NAME"
4353
- set "BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER:\=/%"

mapscript/python/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ add_custom_command(
108108
DEPENDS mapscriptwheel.stamp
109109
OUTPUT mapscripttests.stamp
110110
COMMAND ${PYTHON_VENV_SCRIPTS}/pip install --no-index --find-links=${OUTPUT_FOLDER}/dist mapscript
111-
COMMAND ${PYTHON_VENV_SCRIPTS}/pytest --pyargs mapscript.tests
111+
# ERROR: file or package not found: mapscript.tests (missing __init__.py?) is caused by
112+
# ImportError: DLL load failed while importing _mapscript: The specified module could not be found.
113+
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m pytest --pyargs mapscript.tests
112114
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.project_csv ${PROJECT_SOURCE_DIR}/tests/cities.csv 2 1 EPSG:4326 EPSG:3857 > test.csv
113115
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.shpdump ${PROJECT_SOURCE_DIR}/tests/polygon.shp > shpdump.txt
114116
COMMAND ${PYTHON_VENV_SCRIPTS}/python -m mapscript.examples.shpinfo ${PROJECT_SOURCE_DIR}/tests/polygon.shp > shpinfo.txt

mapscript/python/pymodule.i

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ CreateTupleFromDoubleArray( double *first, unsigned int size ) {
114114
PyObject* val = PyList_GetItem(values, i);
115115

116116
%#if PY_MAJOR_VERSION >= 3
117-
$1[i] = PyUnicode_AsUTF8(key);
118-
$2[i] = PyUnicode_AsUTF8(val);
117+
// Changed in version 3.7: The return type is now const char * rather than char *
118+
// avoid warning C4090: '=': different 'const' qualifiers
119+
$1[i] = (char *)PyUnicode_AsUTF8(key);
120+
$2[i] = (char *)PyUnicode_AsUTF8(val);
119121
%#else
120122
$1[i] = PyString_AsString(key);
121123
$2[i] = PyString_AsString(val);

0 commit comments

Comments
 (0)