mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 03:05:48 +03:00
69 lines
2.3 KiB
Diff
69 lines
2.3 KiB
Diff
From 1e8cc6855d6a8fc1f9dfc933224c3a10fb759f9c Mon Sep 17 00:00:00 2001
|
|
From: Ian McInerney <ian.s.mcinerney@ieee.org>
|
|
Date: Tue, 14 Feb 2023 00:18:56 +0000
|
|
Subject: [PATCH] Relax wxPython version mismatch check to major.minor
|
|
|
|
The previous version check failed when the version was even slightly
|
|
different, including on the revision field. Theoretically the ABI of the
|
|
wx minor versions in use should be the same, so this might work. On the
|
|
other hand, with wxPython it could break as well. YOLO.
|
|
---
|
|
scripting/python_scripting.cpp | 35 +++++++++++++++++++++++++++++++++-
|
|
1 file changed, 34 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/scripting/python_scripting.cpp b/scripting/python_scripting.cpp
|
|
index 87bd67606a..624f3f0a7d 100644
|
|
--- a/scripting/python_scripting.cpp
|
|
+++ b/scripting/python_scripting.cpp
|
|
@@ -50,6 +50,7 @@
|
|
#include <kiplatform/environment.h>
|
|
|
|
#include <wx/app.h>
|
|
+#include <wx/regex.h>
|
|
#include <wx/utils.h>
|
|
|
|
#include <config.h>
|
|
@@ -128,7 +129,39 @@ except:
|
|
wxVI.GetMajor(), wxVI.GetMinor(), wxVI.GetMicro() );
|
|
version = version.Mid( idx + 10 );
|
|
|
|
- if( wxVersion.Cmp( version ) != 0 )
|
|
+ int wxPy_major = 0;
|
|
+ int wxPy_minor = 0;
|
|
+ int wxPy_micro = 0;
|
|
+ int wxPy_rev = 0;
|
|
+
|
|
+ // Compile a regex to extract the wxPython version
|
|
+ wxRegEx re( "([0-9]+)\\.([0-9]+)\\.?([0-9]+)?\\.?([0-9]+)?" );
|
|
+ wxASSERT( re.IsValid() );
|
|
+
|
|
+ if( re.Matches( version ) )
|
|
+ {
|
|
+ wxString v = re.GetMatch( version, 1 );
|
|
+
|
|
+ if( !v.IsEmpty() )
|
|
+ v.ToInt( &wxPy_major );
|
|
+
|
|
+ v = re.GetMatch( version, 2 );
|
|
+
|
|
+ if( !v.IsEmpty() )
|
|
+ v.ToInt( &wxPy_minor );
|
|
+
|
|
+ v = re.GetMatch( version, 3 );
|
|
+
|
|
+ if( !v.IsEmpty() )
|
|
+ v.ToInt( &wxPy_micro );
|
|
+
|
|
+ v = re.GetMatch( version, 4 );
|
|
+
|
|
+ if( !v.IsEmpty() )
|
|
+ v.ToInt( &wxPy_rev );
|
|
+ }
|
|
+
|
|
+ if( ( wxVI.GetMajor() != wxPy_major ) || ( wxVI.GetMinor() != wxPy_minor ) )
|
|
{
|
|
wxString msg = wxT( "The wxPython library was compiled against wxWidgets %s but KiCad is "
|
|
"using %s. Python plugins will not be available." );
|
|
--
|
|
GitLab
|
|
|