diff --git a/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_ConvertF.patch b/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_ConvertF.patch new file mode 100644 index 0000000..138d16e --- /dev/null +++ b/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_ConvertF.patch @@ -0,0 +1,58 @@ +From 21f532975f59f0c156c76cc739f5a93f57d8f6cb Mon Sep 17 00:00:00 2001 +From: Mark Dufour +Date: Tue, 14 Feb 2017 10:48:30 +0100 +Subject: [PATCH] [Coverity] fix issue reported for + SWIG_Python_ConvertFunctionPtr + +Fix Coverity issue reported for SWIG_Python_ConvertFunctionPtr: + +"Execution cannot reach this statement: *ptr = vptr;" + +Because if 'ty' is null, then desc becomes null and we return with +SWIG_ERROR. So 'ty' cannot be null at 'if (ty)'. +--- + Lib/python/pyrun.swg | 21 +++++++++------------ + 1 file changed, 9 insertions(+), 12 deletions(-) + +diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg +index ab1237f62..939a69204 100644 +--- a/Lib/python/pyrun.swg ++++ b/Lib/python/pyrun.swg +@@ -1287,25 +1287,22 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; +- ++ swig_cast_info *tc; ++ + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; +- if (!desc) ++ if (!desc) + return SWIG_ERROR; +- if (ty) { +- swig_cast_info *tc = SWIG_TypeCheck(desc,ty); +- if (tc) { +- int newmemory = 0; +- *ptr = SWIG_TypeCast(tc,vptr,&newmemory); +- assert(!newmemory); /* newmemory handling not yet implemented */ +- } else { +- return SWIG_ERROR; +- } ++ tc = SWIG_TypeCheck(desc,ty); ++ if (tc) { ++ int newmemory = 0; ++ *ptr = SWIG_TypeCast(tc,vptr,&newmemory); ++ assert(!newmemory); /* newmemory handling not yet implemented */ + } else { +- *ptr = vptr; ++ return SWIG_ERROR; + } + return SWIG_OK; + } +-- +2.14.3 + diff --git a/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch b/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch new file mode 100644 index 0000000..9b8b844 --- /dev/null +++ b/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch @@ -0,0 +1,36 @@ +From 9825fcbab5c4ddd867432f9922bebfbec7b78af0 Mon Sep 17 00:00:00 2001 +From: Mark Dufour +Date: Tue, 14 Feb 2017 10:34:37 +0100 +Subject: [PATCH] [Coverity] fix issue reported for SWIG_Python_FixMethods + +Fix Coverity issue reported for SWIG_Python_FixMethods: + +"buffer_size: Calling strncpy with a source string whose length +(10 chars) is greater than or equal to the size argument (10) +will fail to null-terminate buff." + +The issue is only reported for the "swig_ptr: " line, but for +consistency we replace both occurrences of strncpy with memcpy. +--- + Lib/python/pyinit.swg | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg +index 2cc582841..fe45ac941 100644 +--- a/Lib/python/pyinit.swg ++++ b/Lib/python/pyinit.swg +@@ -306,9 +306,9 @@ SWIG_Python_FixMethods(PyMethodDef *methods, + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; +- strncpy(buff, methods[i].ml_doc, ldoc); ++ memcpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; +- strncpy(buff, "swig_ptr: ", 10); ++ memcpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; +-- +2.14.3 + diff --git a/swig-3.0.12-Coverity-fix-issue-reported-for-wrapper-argument-che.patch b/swig-3.0.12-Coverity-fix-issue-reported-for-wrapper-argument-che.patch new file mode 100644 index 0000000..d786568 --- /dev/null +++ b/swig-3.0.12-Coverity-fix-issue-reported-for-wrapper-argument-che.patch @@ -0,0 +1,41 @@ +From 13eeebd2fb3005abc876957c68bde6a92510aa44 Mon Sep 17 00:00:00 2001 +From: Mark Dufour +Date: Tue, 14 Feb 2017 10:53:14 +0100 +Subject: [PATCH] [Coverity] fix issue reported for wrapper argument checking + +Fix Coverity issue reported for wrapper argument checking: + +"Null-checking args suggests that it may be null, but it has already +been dereferenced on all paths leading to the check." + +So 'args' is null checked, but after dereferencing it with +PyTuple_Check(args). +--- + Source/Modules/python.cxx | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx +index a6801fc4e..5e058e773 100644 +--- a/Source/Modules/python.cxx ++++ b/Source/Modules/python.cxx +@@ -2541,9 +2541,14 @@ public: + + if (!fastunpack) { + Wrapper_add_local(f, "ii", "Py_ssize_t ii"); +- if (maxargs - (add_self ? 1 : 0) > 0) +- Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n"); +- Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n"); ++ ++ if (maxargs - (add_self ? 1 : 0) > 0) { ++ Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n"); ++ Append(f->code, "argc = PyObject_Length(args);\n"); ++ } else { ++ Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n"); ++ } ++ + if (add_self) + Append(f->code, "argv[0] = self;\n"); + Printf(f->code, "for (ii = 0; (ii < %d) && (ii < argc); ii++) {\n", add_self ? maxargs - 1 : maxargs); +-- +2.14.3 + diff --git a/swig-3.0.12-Fix-Coverity-issue-reported-for-setslice-pycontainer.patch b/swig-3.0.12-Fix-Coverity-issue-reported-for-setslice-pycontainer.patch new file mode 100644 index 0000000..64308b8 --- /dev/null +++ b/swig-3.0.12-Fix-Coverity-issue-reported-for-setslice-pycontainer.patch @@ -0,0 +1,40 @@ +From 5803e81d488e97623fe29b8629b977be01a8229e Mon Sep 17 00:00:00 2001 +From: Mark Dufour +Date: Mon, 6 Mar 2017 21:16:41 +0100 +Subject: [PATCH] Fix Coverity issue reported for setslice (pycontainer.swg): + +"CID 11151 (#3-1 of 3): Using invalid iterator (INVALIDATE_ITERATOR)18. +increment_iterator: Incrementing iterator it though it is already past +the end of its container." + +Coverity does not understand 'replace_count', so warns that we may go +past self->end() (or self->rend() I guess). +--- + Lib/python/pycontainer.swg | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg +index d40b0baa8..9aefb4fc7 100644 +--- a/Lib/python/pycontainer.swg ++++ b/Lib/python/pycontainer.swg +@@ -351,7 +351,7 @@ namespace swig { + typename Sequence::const_iterator isit = is.begin(); + typename Sequence::iterator it = self->begin(); + std::advance(it,ii); +- for (size_t rc=0; rcend(); ++rc) { + *it++ = *isit++; + for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) + it++; +@@ -367,7 +367,7 @@ namespace swig { + typename Sequence::const_iterator isit = is.begin(); + typename Sequence::reverse_iterator it = self->rbegin(); + std::advance(it,size-ii-1); +- for (size_t rc=0; rcrend(); ++rc) { + *it++ = *isit++; + for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) + it++; +-- +2.14.3 + diff --git a/swig-3.0.12-Fix-generated-code-for-constant-expressions-containi.patch b/swig-3.0.12-Fix-generated-code-for-constant-expressions-containi.patch new file mode 100644 index 0000000..d44ef55 --- /dev/null +++ b/swig-3.0.12-Fix-generated-code-for-constant-expressions-containi.patch @@ -0,0 +1,191 @@ +From 90ba174fcea1618af57aa594199541d47a89b7f6 Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Sun, 17 Sep 2017 19:02:55 +0100 +Subject: [PATCH 1/2] Fix generated code for constant expressions containing + wchar_t L literals. + +Such as: + # define __WCHAR_MAX (0x7fffffff + L'\0') + +Reported on swig-user mailing list. +--- + CHANGES.current | 5 +++++ + Examples/test-suite/csharp/preproc_constants_c_runme.cs | 3 ++- + Examples/test-suite/csharp/preproc_constants_runme.cs | 2 ++ + Examples/test-suite/d/preproc_constants_c_runme.1.d | 2 ++ + Examples/test-suite/d/preproc_constants_c_runme.2.d | 2 ++ + Examples/test-suite/d/preproc_constants_runme.1.d | 2 ++ + Examples/test-suite/d/preproc_constants_runme.2.d | 2 ++ + Examples/test-suite/php/preproc_constants_c_runme.php | 2 ++ + Examples/test-suite/php/preproc_constants_runme.php | 2 ++ + Examples/test-suite/php5/preproc_constants_c_runme.php | 2 ++ + Examples/test-suite/php5/preproc_constants_runme.php | 2 ++ + Examples/test-suite/preproc_constants.i | 3 +++ + Source/CParse/parser.y | 2 +- + 13 files changed, 29 insertions(+), 2 deletions(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index 1e4a244..b455a9f 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.0.0 (in progress) +# =========================== +# +#+2017-09-17: wsfulton +#+ Fix generated code for constant expressions containing wchar_t L literals such as: +#+ # define __WCHAR_MAX (0x7fffffff + L'\0') +#+ # define __WCHAR_MIN (-__WCHAR_MAX - 1) +#+ +# 2017-09-10: mlamarre +# [Python] Patch #1083. Define_DEBUG to 1 to do exactly like Visual Studio +# /LDd, /MDd or /MTd compiler options. +diff --git a/Examples/test-suite/csharp/preproc_constants_c_runme.cs b/Examples/test-suite/csharp/preproc_constants_c_runme.cs +index 76c684d..1c28e49 100644 +--- a/Examples/test-suite/csharp/preproc_constants_c_runme.cs ++++ b/Examples/test-suite/csharp/preproc_constants_c_runme.cs +@@ -61,7 +61,8 @@ public class runme { + assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() ); + assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() ); + assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() ); +- ++ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() ); ++ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() ); + } + static void assert(bool assertion) { + if (!assertion) +diff --git a/Examples/test-suite/csharp/preproc_constants_runme.cs b/Examples/test-suite/csharp/preproc_constants_runme.cs +index 9fae591..6b02e30 100644 +--- a/Examples/test-suite/csharp/preproc_constants_runme.cs ++++ b/Examples/test-suite/csharp/preproc_constants_runme.cs +@@ -60,6 +60,8 @@ public class runme { + assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() ); + assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() ); + assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() ); ++ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() ); ++ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() ); + + } + static void assert(bool assertion) { +diff --git a/Examples/test-suite/d/preproc_constants_c_runme.1.d b/Examples/test-suite/d/preproc_constants_c_runme.1.d +index d846c71..2b349af 100644 +--- a/Examples/test-suite/d/preproc_constants_c_runme.1.d ++++ b/Examples/test-suite/d/preproc_constants_c_runme.1.d +@@ -61,4 +61,6 @@ void main() { + static assert(is(int == typeof(EXPR_LAND()))); + static assert(is(int == typeof(EXPR_LOR()))); + static assert(is(double == typeof(EXPR_CONDITIONAL()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MAX()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MIN()))); + } +diff --git a/Examples/test-suite/d/preproc_constants_c_runme.2.d b/Examples/test-suite/d/preproc_constants_c_runme.2.d +index 9bdbb93..1bac525 100644 +--- a/Examples/test-suite/d/preproc_constants_c_runme.2.d ++++ b/Examples/test-suite/d/preproc_constants_c_runme.2.d +@@ -61,4 +61,6 @@ void main() { + static assert(is(int == typeof(EXPR_LAND()))); + static assert(is(int == typeof(EXPR_LOR()))); + static assert(is(double == typeof(EXPR_CONDITIONAL()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MAX()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MIN()))); + } +diff --git a/Examples/test-suite/d/preproc_constants_runme.1.d b/Examples/test-suite/d/preproc_constants_runme.1.d +index 009405f..f743f48 100644 +--- a/Examples/test-suite/d/preproc_constants_runme.1.d ++++ b/Examples/test-suite/d/preproc_constants_runme.1.d +@@ -60,4 +60,6 @@ void main() { + static assert(is(bool == typeof(EXPR_LAND()))); + static assert(is(bool == typeof(EXPR_LOR()))); + static assert(is(double == typeof(EXPR_CONDITIONAL()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MAX()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MIN()))); + } +diff --git a/Examples/test-suite/d/preproc_constants_runme.2.d b/Examples/test-suite/d/preproc_constants_runme.2.d +index 2d92ef0..0d96c37 100644 +--- a/Examples/test-suite/d/preproc_constants_runme.2.d ++++ b/Examples/test-suite/d/preproc_constants_runme.2.d +@@ -60,4 +60,6 @@ void main() { + static assert(is(bool == typeof(EXPR_LAND()))); + static assert(is(bool == typeof(EXPR_LOR()))); + static assert(is(double == typeof(EXPR_CONDITIONAL()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MAX()))); ++ static assert(is(int == typeof(EXPR_WCHAR_MIN()))); + } +diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php +index af9b76e..e59fe18 100644 +--- a/Examples/test-suite/php/preproc_constants_c_runme.php ++++ b/Examples/test-suite/php/preproc_constants_c_runme.php +@@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant + check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type"); + check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); + check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); ++check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); ++check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); + + ?> +diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php +index 5c9119b..8e117ea 100644 +--- a/Examples/test-suite/php/preproc_constants_runme.php ++++ b/Examples/test-suite/php/preproc_constants_runme.php +@@ -61,5 +61,7 @@ check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants. + check::equal(gettype(preproc_constants::EXPR_LAND), "boolean", "preproc_constants.EXPR_LAND has unexpected type"); + check::equal(gettype(preproc_constants::EXPR_LOR), "boolean", "preproc_constants.EXPR_LOR has unexpected type"); + check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); ++check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); ++check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); + + ?> +diff --git a/Examples/test-suite/php5/preproc_constants_c_runme.php b/Examples/test-suite/php5/preproc_constants_c_runme.php +index 1ea0195..d978fab 100644 +--- a/Examples/test-suite/php5/preproc_constants_c_runme.php ++++ b/Examples/test-suite/php5/preproc_constants_c_runme.php +@@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant + check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type"); + check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); + check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); ++check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); ++check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); + + ?> +diff --git a/Examples/test-suite/php5/preproc_constants_runme.php b/Examples/test-suite/php5/preproc_constants_runme.php +index fb9ee4f..7527026 100644 +--- a/Examples/test-suite/php5/preproc_constants_runme.php ++++ b/Examples/test-suite/php5/preproc_constants_runme.php +@@ -70,5 +70,7 @@ check::equal(gettype(preproc_constants::EXPR_LAND), "integer", "preproc_constant + check::equal(gettype(preproc_constants::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); + + check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); ++check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); ++check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); + + ?> +diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i +index 3a999ad..16b44c9 100644 +--- a/Examples/test-suite/preproc_constants.i ++++ b/Examples/test-suite/preproc_constants.i +@@ -87,6 +87,9 @@ + #define EXPR_LOR 0xFF || 1 + #define EXPR_CONDITIONAL true ? 2 : 2.2 + ++#define EXPR_WCHAR_MAX (0x7fffffff + L'\0') ++#define EXPR_WCHAR_MIN (-EXPR_WCHAR_MAX - 1) ++ + #define EXPR_CHAR_COMPOUND_ADD 'A' + 12 + #define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6 + #define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p') +diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y +index 2e92cd0..273dadb 100644 +--- a/Source/CParse/parser.y ++++ b/Source/CParse/parser.y +@@ -194,7 +194,7 @@ int SWIG_cparse_template_reduce(int treduce) { + * ----------------------------------------------------------------------------- */ + + static int promote_type(int t) { +- if (t <= T_UCHAR || t == T_CHAR) return T_INT; ++ if (t <= T_UCHAR || t == T_CHAR || t == T_WCHAR) return T_INT; + return t; + } + +-- +2.9.5 + diff --git a/swig-3.0.12-fix-collections.patch b/swig-3.0.12-fix-collections.patch new file mode 100644 index 0000000..b1ecb3a --- /dev/null +++ b/swig-3.0.12-fix-collections.patch @@ -0,0 +1,76 @@ +From 4079fb927b3761ee4e44ff103f37440cb8f3e260 Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Tue, 12 Jun 2018 21:05:07 +0100 +Subject: [PATCH] Python 3.7 support - deprecation of classes in the + collections module + +Change the base classes in the pyabc.i file to use the +collections.abc module instead of collections due to the deprecation +of the classes in the collections module in Python 3.7. +--- + .../python/python_abstractbase_runme3.py | 24 +++++++++++++------ + Lib/python/pyabc.i | 14 +++++------ + 4 files changed, 53 insertions(+), 18 deletions(-) + +diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme3.py +index 4fdc799352..9f99dcb546 100644 +--- a/Examples/test-suite/python/python_abstractbase_runme3.py ++++ b/Examples/test-suite/python/python_abstractbase_runme3.py +@@ -1,5 +1,11 @@ ++import sys ++ ++# collections.abc requires Python 3.3+ ++if sys.version_info[0:2] < (3, 3): ++ exit(0) ++ + from python_abstractbase import * +-from collections import * ++import collections.abc + + # This is expected to fail with -builtin option + # Builtin types can't inherit from pure-python abstract bases +@@ -10,12 +16,16 @@ + if not is_swig_py3: + exit(0) + +-assert issubclass(Mapii, MutableMapping) +-assert issubclass(Multimapii, MutableMapping) +-assert issubclass(IntSet, MutableSet) +-assert issubclass(IntMultiset, MutableSet) +-assert issubclass(IntVector, MutableSequence) +-assert issubclass(IntList, MutableSequence) ++def check_issubclass(derived, base): ++ if not issubclass(derived, base): ++ raise RuntimeError("{} is not a subclass of {}".format(derived, base)) ++ ++check_issubclass(Mapii, collections.abc.MutableMapping) ++check_issubclass(Multimapii, collections.abc.MutableMapping) ++check_issubclass(IntSet, collections.abc.MutableSet) ++check_issubclass(IntMultiset, collections.abc.MutableSet) ++check_issubclass(IntVector, collections.abc.MutableSequence) ++check_issubclass(IntList, collections.abc.MutableSequence) + + mapii = Mapii() + multimapii = Multimapii() +diff --git a/Lib/python/pyabc.i b/Lib/python/pyabc.i +index 12ce65985e..fbd91dce44 100644 +--- a/Lib/python/pyabc.i ++++ b/Lib/python/pyabc.i +@@ -1,10 +1,10 @@ + %define %pythonabc(Type, Abc) + %feature("python:abc", #Abc) Type; + %enddef +-%pythoncode %{import collections%} +-%pythonabc(std::vector, collections.MutableSequence); +-%pythonabc(std::list, collections.MutableSequence); +-%pythonabc(std::map, collections.MutableMapping); +-%pythonabc(std::multimap, collections.MutableMapping); +-%pythonabc(std::set, collections.MutableSet); +-%pythonabc(std::multiset, collections.MutableSet); ++%pythoncode %{import collections.abc%} ++%pythonabc(std::vector, collections.abc.MutableSequence); ++%pythonabc(std::list, collections.abc.MutableSequence); ++%pythonabc(std::map, collections.abc.MutableMapping); ++%pythonabc(std::multimap, collections.abc.MutableMapping); ++%pythonabc(std::set, collections.abc.MutableSet); ++%pythonabc(std::multiset, collections.abc.MutableSet); diff --git a/swig.changes b/swig.changes index f7692ef..efc4b9a 100644 --- a/swig.changes +++ b/swig.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Mon Sep 17 12:15:04 UTC 2018 - Tomáš Chvátal + +- Add patches to build with python 3.7 properly: + * swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_ConvertF.patch + * swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch + * swig-3.0.12-Coverity-fix-issue-reported-for-wrapper-argument-che.patch + * swig-3.0.12-Fix-Coverity-issue-reported-for-setslice-pycontainer.patch + * swig-3.0.12-Fix-generated-code-for-constant-expressions-containi.patch + * swig-3.0.12-fix-collections.patch +- Use version req to check for 1500 instead for non-existing release +- Move to generic requires those that are true under both conditions +- Use autopatch to apply all the patches at once + ------------------------------------------------------------------- Wed Jan 3 14:30:52 UTC 2018 - tchvatal@suse.com diff --git a/swig.spec b/swig.spec index c849ab2..3acbb10 100644 --- a/swig.spec +++ b/swig.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -21,34 +21,40 @@ %define docpath %{_docdir}/%{name}-%{version} BuildRequires: perl-Test-Simple BuildRequires: perl-devel -BuildRequires: pkgconfig BuildRequires: ruby %endif %if 0%{?suse_version} > 0 %define docpath %{_docdir}/%{name} -BuildRequires: fdupes -BuildRequires: pkgconfig BuildRequires: ruby-devel %endif Name: swig Version: 3.0.12 Release: 0 Summary: Simplified Wrapper and Interface Generator -License: GPL-3.0+ AND BSD-3-Clause +License: GPL-3.0-or-later AND BSD-3-Clause Group: Development/Languages/C and C++ -Url: http://www.swig.org/ +URL: http://www.swig.org/ Source: http://sourceforge.net/projects/swig/files/swig/%{name}-%{version}/%{name}-%{version}.tar.gz Source1: %{name}.rpmlintrc Patch2: swig308-isfinite.diff Patch3: swig-ocaml-int64.patch Patch4: swig-perl526.patch +Patch5: swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_ConvertF.patch +Patch6: swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch +Patch7: swig-3.0.12-Coverity-fix-issue-reported-for-wrapper-argument-che.patch +Patch8: swig-3.0.12-Fix-Coverity-issue-reported-for-setslice-pycontainer.patch +Patch9: swig-3.0.12-Fix-generated-code-for-constant-expressions-containi.patch +Patch10: swig-3.0.12-fix-collections.patch BuildRequires: autoconf BuildRequires: automake +BuildRequires: bison +BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: pcre-devel BuildRequires: perl -%if 0%{?suse_version} > 1325 +BuildRequires: pkgconfig +%if 0%{?suse_version} >= 1500 BuildRequires: libboost_headers-devel BuildRequires: python3-devel BuildRequires: python3-tools @@ -113,9 +119,7 @@ understandig SWIG usage. %prep %setup -q -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 +%autopatch -p1 %build %ifarch s390 s390x @@ -130,7 +134,7 @@ export CCSHARED="-fPIC" make %{?_smp_mflags} %check -%if 0%{?suse_version} > 1325 +%if 0%{?suse_version} >= 1500 export PY3=true %endif make %{?_smp_mflags} check