Skip to content

Commit

Permalink
Python bindings: fix compatibility issue with SWIG 4.3.0 and PYTHONWA…
Browse files Browse the repository at this point in the history
…RNINGS=error

Fixes conda-forge/gdal-feedstock#995
  • Loading branch information
rouault committed Oct 28, 2024
1 parent 0332c83 commit 5c0490e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cmake_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ jobs:
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib
$GITHUB_WORKSPACE/install-gdal/bin/gdalinfo --version
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3.8/site-packages python3 -c "from osgeo import gdal;print(gdal.VersionInfo(None))"
# Test fix for https://github.com/conda-forge/gdal-feedstock/issues/995
PYTHONWARNINGS="error" PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3.8/site-packages python3 python -c "from osgeo import gdal"
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3.8/site-packages python3 $GITHUB_WORKSPACE/scripts/check_doc.py
- name: CMake with rpath
run: |
Expand Down
4 changes: 4 additions & 0 deletions swig/python/modify_cpp_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ string(REPLACE "if (--interpreter_counter != 0) // another sub-interpreter may s
"/* Even Rouault / GDAL hack for SWIG >= 4.1 related to objects not being freed. See swig/python/modify_cpp_files.cmake for more details */\nif( 1 )"
_CONTENTS "${_CONTENTS}")

# Works around https://github.com/swig/swig/issues/3061
string(REPLACE "# define SWIG_HEAPTYPES" "// Below is disabled because of https://github.com/swig/swig/issues/3061\n// # define SWIG_HEAPTYPES"
_CONTENTS "${_CONTENTS}")

file(WRITE ${FILE} "${_CONTENTS}")

0 comments on commit 5c0490e

Please sign in to comment.