1
0
Dominique Leuenberger 2020-08-06 15:32:14 +00:00 committed by Git OBS Bridge
commit b778ae565a
6 changed files with 355 additions and 5 deletions

View File

@ -0,0 +1,72 @@
From 0c055a0af876d4f44ebe04ebb744dfc88b2243ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 30 May 2020 02:04:41 +0200
Subject: [PATCH 1/3] Fix conversion of variant list members
Item() returns either a Node* or (with wxUSE_STL=1) a
compatibility_iterator. While the former is silently and erroneously
converted to a Variant using the Variant(void*) overload, the STL
flavor fortunately failed. Dereference the Node*/iterator before
passing it to wxVariant_out_helper(const Variant&).
---
sip/cpp/sip_corewxVariantList.cpp | 2 +-
sip/cpp/sip_propgridwxPGVariantList.cpp | 2 +-
src/pgvariant.sip | 2 +-
src/variant.sip | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sip/cpp/sip_corewxVariantList.cpp b/sip/cpp/sip_corewxVariantList.cpp
index 0c9f0f4c..fe9be050 100644
--- a/sip/cpp/sip_corewxVariantList.cpp
+++ b/sip/cpp/sip_corewxVariantList.cpp
@@ -84,7 +84,7 @@ static PyObject *convertFrom_wxVariantList(void *sipCppV, PyObject *)
size_t idx = 0;
PyObject* value = PyList_New(0);
for (idx=0; idx < sipCpp->GetCount(); idx++) {
- PyObject* item = wxVariant_out_helper(sipCpp->Item(idx));
+ PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)->GetData());
PyList_Append(value, item);
}
return value;
diff --git a/sip/cpp/sip_propgridwxPGVariantList.cpp b/sip/cpp/sip_propgridwxPGVariantList.cpp
index 2c21df45..ca2d0b65 100644
--- a/sip/cpp/sip_propgridwxPGVariantList.cpp
+++ b/sip/cpp/sip_propgridwxPGVariantList.cpp
@@ -84,7 +84,7 @@ static PyObject *convertFrom_wxPGVariantList(void *sipCppV, PyObject *)
size_t idx = 0;
PyObject* value = PyList_New(0);
for (idx=0; idx < sipCpp->GetCount(); idx++) {
- PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx));
+ PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)->GetData());
PyList_Append(value, item);
}
return value;
diff --git a/src/pgvariant.sip b/src/pgvariant.sip
index 05a2d429..32cd5fe4 100644
--- a/src/pgvariant.sip
+++ b/src/pgvariant.sip
@@ -182,7 +182,7 @@ PyObject* wxPGVariant_out_helper(const wxVariant& value)
size_t idx = 0;
PyObject* value = PyList_New(0);
for (idx=0; idx < sipCpp->GetCount(); idx++) {
- PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx));
+ PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)->GetData());
PyList_Append(value, item);
}
return value;
diff --git a/src/variant.sip b/src/variant.sip
index c4a53eef..9e2572e7 100644
--- a/src/variant.sip
+++ b/src/variant.sip
@@ -77,7 +77,7 @@
size_t idx = 0;
PyObject* value = PyList_New(0);
for (idx=0; idx < sipCpp->GetCount(); idx++) {
- PyObject* item = wxVariant_out_helper(sipCpp->Item(idx));
+ PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)->GetData());
PyList_Append(value, item);
}
return value;
--
2.26.2

View File

@ -0,0 +1,59 @@
From 5b810b129db00a98c84672cd94a4a4be83ba8e69 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Mon, 1 Jun 2020 17:25:41 +0200
Subject: [PATCH] Fix wxUIActionSimulator::Text() parameter documentation
This function explicitly accepts ASCII strings only, so it's limited to
"const char*", but was incorrectly documented as taking wxString.
Closes https://github.com/wxWidgets/wxWidgets/pull/1879
---
ext/wxWidgets/interface/wx/uiaction.h | 4 ++--
sip/cpp/sip_corewxUIActionSimulator.cpp | 2 +-
sip/gen/uiaction.sip | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ext/wxWidgets/interface/wx/uiaction.h b/ext/wxWidgets/interface/wx/uiaction.h
index 27b3aaf2..7d4eba52 100644
--- a/ext/wxWidgets/interface/wx/uiaction.h
+++ b/ext/wxWidgets/interface/wx/uiaction.h
@@ -176,8 +176,8 @@ public:
keyboard layout but may not work with other layouts.
@param text
- The string to type.
+ The string, containing only US ASCII characters, to type.
*/
- bool Text(const wxString& text);
+ bool Text(const char* text);
};
diff --git a/sip/cpp/sip_corewxUIActionSimulator.cpp b/sip/cpp/sip_corewxUIActionSimulator.cpp
index 42bc481a..85a47384 100644
--- a/sip/cpp/sip_corewxUIActionSimulator.cpp
+++ b/sip/cpp/sip_corewxUIActionSimulator.cpp
@@ -496,7 +496,7 @@ static PyObject *meth_wxUIActionSimulator_Text(PyObject *sipSelf, PyObject *sipA
PyErr_Clear();
Py_BEGIN_ALLOW_THREADS
- sipRes = sipCpp->Text(*text);
+ sipRes = sipCpp->Text(text->c_str());
Py_END_ALLOW_THREADS
sipReleaseType(const_cast< ::wxString *>(text),sipType_wxString,textState);
diff --git a/sip/gen/uiaction.sip b/sip/gen/uiaction.sip
index 788e2b65..ff27dfa0 100644
--- a/sip/gen/uiaction.sip
+++ b/sip/gen/uiaction.sip
@@ -129,7 +129,7 @@ public:
%End
bool Text(
- const wxString & text
+ const char* text
);
%Docstring
Text(text) -> bool
--
2.27.0

View File

@ -0,0 +1,181 @@
From a88ca321429320675fba92f74d4f88d7e9a1845e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Mon, 1 Jun 2020 04:06:53 +0200
Subject: [PATCH 3/3] Use explicit wxString::c_str conversion for
sipFindType(const char*)
---
etgtools/tweaker_tools.py | 6 +++---
sip/cpp/sip_corecmodule.cpp | 18 +++++++++---------
sip/gen/object.sip | 6 +++---
sip/gen/window.sip | 6 +++---
src/wxpy_api.sip | 6 +++---
5 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py
index 09c798be..c07fdfa6 100644
--- a/etgtools/tweaker_tools.py
+++ b/etgtools/tweaker_tools.py
@@ -520,14 +520,14 @@ def addSipConvertToSubClassCode(klass):
%ConvertToSubClassCode
const wxClassInfo* info = sipCpp->GetClassInfo();
wxString name = info->GetClassName();
- bool exists = sipFindType(name) != NULL;
+ bool exists = sipFindType(name.c_str()) != NULL;
while (info && !exists) {
info = info->GetBaseClass1();
name = info->GetClassName();
- exists = sipFindType(name) != NULL;
+ exists = sipFindType(name.c_str()) != NULL;
}
if (info)
- sipType = sipFindType(name);
+ sipType = sipFindType(name.c_str());
else
sipType = NULL;
%End
diff --git a/sip/cpp/sip_corecmodule.cpp b/sip/cpp/sip_corecmodule.cpp
index bab2a087..3fcddece 100644
--- a/sip/cpp/sip_corecmodule.cpp
+++ b/sip/cpp/sip_corecmodule.cpp
@@ -7576,7 +7576,7 @@ static PyObject* i_wxPyConstructObject(void* ptr,
if (pos != wxNOT_FOUND)
name = name.Mid(pos + nsDelimiter.Len());
- const sipTypeDef* td = sipFindType(name);
+ const sipTypeDef* td = sipFindType(name.c_str());
if (!td)
return NULL;
PyObject* transferObj = setThisOwn ? Py_None : NULL;
@@ -7594,7 +7594,7 @@ static bool i_wxPyWrappedPtr_Check(PyObject* obj)
// Check if a PyObject is a specific wrapped class or subclass
static bool i_wxPyWrappedPtr_TypeCheck(PyObject* obj, const wxString& className)
{
- const sipTypeDef* td = sipFindType(className);
+ const sipTypeDef* td = sipFindType(className.c_str());
if (!td)
return false;
return sipCanConvertToType(obj, td, SIP_NO_CONVERTORS);
@@ -7604,7 +7604,7 @@ static bool i_wxPyWrappedPtr_TypeCheck(PyObject* obj, const wxString& className)
// Convert a wrapped SIP object to its C++ pointer, ensuring that it is of the expected type
static bool i_wxPyConvertWrappedPtr(PyObject* obj, void **ptr, const wxString& className)
{
- const sipTypeDef* td = sipFindType(className);
+ const sipTypeDef* td = sipFindType(className.c_str());
if (!td)
return false;
if (! sipCanConvertToType(obj, td, SIP_NO_CONVERTORS))
@@ -16045,14 +16045,14 @@ static const sipTypeDef *sipSubClass_wxObject(void **sipCppRet)
const wxClassInfo* info = sipCpp->GetClassInfo();
wxString name = info->GetClassName();
- bool exists = sipFindType(name) != NULL;
+ bool exists = sipFindType(name.c_str()) != NULL;
while (info && !exists) {
info = info->GetBaseClass1();
name = info->GetClassName();
- exists = sipFindType(name) != NULL;
+ exists = sipFindType(name.c_str()) != NULL;
}
if (info)
- sipType = sipFindType(name);
+ sipType = sipFindType(name.c_str());
else
sipType = NULL;
@@ -16069,14 +16069,14 @@ static const sipTypeDef *sipSubClass_wxWindow(void **sipCppRet)
const wxClassInfo* info = sipCpp->GetClassInfo();
wxString name = info->GetClassName();
- bool exists = sipFindType(name) != NULL;
+ bool exists = sipFindType(name.c_str()) != NULL;
while (info && !exists) {
info = info->GetBaseClass1();
name = info->GetClassName();
- exists = sipFindType(name) != NULL;
+ exists = sipFindType(name.c_str()) != NULL;
}
if (info)
- sipType = sipFindType(name);
+ sipType = sipFindType(name.c_str());
else
sipType = NULL;
diff --git a/sip/gen/object.sip b/sip/gen/object.sip
index d94e1243..71d2fe78 100644
--- a/sip/gen/object.sip
+++ b/sip/gen/object.sip
@@ -189,14 +189,14 @@ public:
%ConvertToSubClassCode
const wxClassInfo* info = sipCpp->GetClassInfo();
wxString name = info->GetClassName();
- bool exists = sipFindType(name) != NULL;
+ bool exists = sipFindType(name.c_str()) != NULL;
while (info && !exists) {
info = info->GetBaseClass1();
name = info->GetClassName();
- exists = sipFindType(name) != NULL;
+ exists = sipFindType(name.c_str()) != NULL;
}
if (info)
- sipType = sipFindType(name);
+ sipType = sipFindType(name.c_str());
else
sipType = NULL;
%End
diff --git a/sip/gen/window.sip b/sip/gen/window.sip
index 6ad84464..b29898bb 100644
--- a/sip/gen/window.sip
+++ b/sip/gen/window.sip
@@ -2932,14 +2932,14 @@ public:
%ConvertToSubClassCode
const wxClassInfo* info = sipCpp->GetClassInfo();
wxString name = info->GetClassName();
- bool exists = sipFindType(name) != NULL;
+ bool exists = sipFindType(name.c_str()) != NULL;
while (info && !exists) {
info = info->GetBaseClass1();
name = info->GetClassName();
- exists = sipFindType(name) != NULL;
+ exists = sipFindType(name.c_str()) != NULL;
}
if (info)
- sipType = sipFindType(name);
+ sipType = sipFindType(name.c_str());
else
sipType = NULL;
%End
diff --git a/src/wxpy_api.sip b/src/wxpy_api.sip
index 5e63fc58..ac9c10ad 100644
--- a/src/wxpy_api.sip
+++ b/src/wxpy_api.sip
@@ -111,7 +111,7 @@ static PyObject* i_wxPyConstructObject(void* ptr,
if (pos != wxNOT_FOUND)
name = name.Mid(pos + nsDelimiter.Len());
- const sipTypeDef* td = sipFindType(name);
+ const sipTypeDef* td = sipFindType(name.c_str());
if (!td)
return NULL;
PyObject* transferObj = setThisOwn ? Py_None : NULL;
@@ -129,7 +129,7 @@ static bool i_wxPyWrappedPtr_Check(PyObject* obj)
// Check if a PyObject is a specific wrapped class or subclass
static bool i_wxPyWrappedPtr_TypeCheck(PyObject* obj, const wxString& className)
{
- const sipTypeDef* td = sipFindType(className);
+ const sipTypeDef* td = sipFindType(className.c_str());
if (!td)
return false;
return sipCanConvertToType(obj, td, SIP_NO_CONVERTORS);
@@ -139,7 +139,7 @@ static bool i_wxPyWrappedPtr_TypeCheck(PyObject* obj, const wxString& className)
// Convert a wrapped SIP object to its C++ pointer, ensuring that it is of the expected type
static bool i_wxPyConvertWrappedPtr(PyObject* obj, void **ptr, const wxString& className)
{
- const sipTypeDef* td = sipFindType(className);
+ const sipTypeDef* td = sipFindType(className.c_str());
if (!td)
return false;
if (! sipCanConvertToType(obj, td, SIP_NO_CONVERTORS))
--
2.26.2

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Jul 1 12:55:23 UTC 2020 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Wrap all relevant build dependencies when building with system
wxWidgets library.
- Add patches to allow building with STL variant of wxGTK:
* 0001-Fix-conversion-of-variant-list-members.patch
* use_stl_build.patch
* 0001-Fix-wxUIActionSimulator-Text-parameter-documentation.patch
* 0003-Use-explicit-wxString-c_str-conversion-for-sipFindTy.patch
-------------------------------------------------------------------
Fri May 29 22:21:35 UTC 2020 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -37,19 +37,31 @@ Source: https://files.pythonhosted.org/packages/source/w/wxPython/wxPyth
Source1: python-wxPython-rpmlintrc
# PATCH-FIX-OPENSUSE fix_no_return_in_nonvoid.patch -- Fix lack of return in nonvoid functions
Patch0: fix_no_return_in_nonvoid.patch
# PATCH-FIX-OPENSUSE
Patch1: use_stl_build.patch
# PATCH-FIX-UPSTREAM -- patch for bundled wxWidgets
Patch2: 0001-Fix-conversion-of-variant-list-members.patch
# PATCH-FIX-UPSTREAM
Patch3: 0001-Fix-wxUIActionSimulator-Text-parameter-documentation.patch
# PATCH-FIX-UPSTREAM
Patch4: 0003-Use-explicit-wxString-c_str-conversion-for-sipFindTy.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools}
BuildRequires: c++_compiler
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: xorg-x11-server
BuildRequires: pkgconfig(cppunit)
%endif
%if %{with syswx}
BuildRequires: wxGTK3-devel
%else
BuildRequires: freeglut-devel
BuildRequires: gstreamer-plugins-base-devel
BuildRequires: libjbig-devel
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: xorg-x11-server
BuildRequires: pkgconfig(cppunit)
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(libjpeg)
@ -63,6 +75,7 @@ BuildRequires: pkgconfig(sm)
BuildRequires: pkgconfig(webkit2gtk-4.0)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xtst)
%endif
Requires: python-six
Requires(post): update-alternatives
Requires(postun): update-alternatives
@ -101,6 +114,10 @@ Provides translations to the package %{name}.
%prep
%setup -q -n wxPython-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
sed -i -e '/^#!\//, 1d' wx/py/*.py
sed -i -e '/^#!\//, 1d' wx/tools/*.py
sed -i -e '/^#!\//, 1d' wx/py/tests/*.py

10
use_stl_build.patch Normal file
View File

@ -0,0 +1,10 @@
--- wxPython-4.1.0/buildtools/build_wxwidgets.py_orig 2020-05-30 01:24:47.890132236 +0200
+++ wxPython-4.1.0/buildtools/build_wxwidgets.py 2020-05-30 01:25:59.574988273 +0200
@@ -362,6 +362,7 @@
else:
configure_opts.append("--enable-universal_binary=%s" % options.mac_universal_binary)
+ configure_opts.append("--enable-stl")
print("Configure options: " + repr(configure_opts))
wxBuilder = builder.AutoconfBuilder()