From d05306a45b4aa4e84376829f008fa60eb3c3806b Mon Sep 17 00:00:00 2001 From: Jim Easterbrook Date: Sat, 2 Dec 2023 11:40:10 +0000 Subject: [PATCH] Improved pre-processing for SWIG problems --- src/swig-0_28_0/basicio_wrap.cxx | 9 +-------- utils/build_swig.py | 8 +++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/swig-0_28_0/basicio_wrap.cxx b/src/swig-0_28_0/basicio_wrap.cxx index 30079e1a..2a4578e4 100644 --- a/src/swig-0_28_0/basicio_wrap.cxx +++ b/src/swig-0_28_0/basicio_wrap.cxx @@ -9978,14 +9978,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin__Exiv2__MemIo_clientdata = {0, 0, 0, 0 static SwigPyGetSet XPathIo___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin__Exiv2__XPathIo_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_FunpackGetterClosure, 0, (char *)"\n" - " The extension of the temporary file which is created when getting input data\n" - " to read metadata. This file will be deleted in destructor.\n" - "\n" - " The extension of the generated file which is created when getting input data\n" - " to add or modify the metadata.\n" - "Default constructor that reads data from stdin/data uri path and writes them to the temp file.\n" - "", &XPathIo___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_FunpackGetterClosure, 0, (char *)" Default constructor that reads data from stdin/data uri path and writes them to the temp file.", &XPathIo___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; diff --git a/utils/build_swig.py b/utils/build_swig.py index 2099711d..ba956604 100644 --- a/utils/build_swig.py +++ b/utils/build_swig.py @@ -120,9 +120,11 @@ def main(): with open(os.path.join(incl_dir, file), 'r') as in_file: with open(os.path.join(dest, file), 'w') as out_file: for line in in_file.readlines(): - if 'static constexpr auto' in line: - continue - line = attr.sub('', line) + if swig_version < (4, 2, 0): + line = line.replace('static constexpr auto', + 'static const char*') + if swig_version < (4, 1, 0): + line = attr.sub('', line) out_file.write(line) # make options list swig_opts = ['-c++', '-python', '-builtin',