Prevent KiCad launch on Windows 7 if python 3.8 or newer is bundled

Soon to be a permanent check regardless of python on Windows
This commit is contained in:
Marek Roszko 2021-01-21 21:28:38 -05:00
parent 8831b5a785
commit 320ca5a0d0
3 changed files with 42 additions and 0 deletions

View File

@ -69,6 +69,11 @@
#define WXPYTHON_VERSION "@WXPYTHON_VERSION@" #define WXPYTHON_VERSION "@WXPYTHON_VERSION@"
#endif #endif
#if defined( KICAD_SCRIPTING )
#define PYTHON_VERSION_MAJOR @PYTHON_VERSION_MAJOR@
#define PYTHON_VERSION_MINOR @PYTHON_VERSION_MINOR@
#endif
/// A file extension with a leading '.' is a suffix, and this one is used on /// A file extension with a leading '.' is a suffix, and this one is used on
/// top level program modules which implement the KIFACE. /// top level program modules which implement the KIFACE.
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@" #define KIFACE_SUFFIX "@KIFACE_SUFFIX@"

View File

@ -47,6 +47,10 @@
#include <confirm.h> #include <confirm.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#if defined(_WIN32)
#include <config.h>
#include <VersionHelpers.h>
#endif
// Only a single KIWAY is supported in this single_top top level component, // Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO. // which is dedicated to loading only a single DSO.
@ -160,6 +164,20 @@ struct APP_SINGLE_TOP : public wxApp
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF ); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF );
#endif #endif
#if defined( _WIN32 ) && defined( PYTHON_VERSION_MAJOR ) \
&& ( ( PYTHON_VERSION_MAJOR == 3 && PYTHON_VERSION_MINOR >= 8 ) \
|| PYTHON_VERSION_MAJOR > 3 )
// Python 3.8 switched to Windows 8+ API, we do not support Windows 7 and will not attempt to hack around it
// Gracefully inform the user and refuse to start (because python will crash us if we continue)
if( !IsWindows8OrGreater() )
{
wxMessageBox( _( "Windows 7 and older is no longer supported by KiCad and it's dependencies." ),
_( "Unsupported Operating System" ), wxOK | wxICON_ERROR );
return false;
}
#endif
// Force wxHtmlWinParser initialization when a wxHtmlWindow is used only // Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
// in a shared library (.so or .dll file) // in a shared library (.so or .dll file)
// Otherwise the Html text is displayed as plain text. // Otherwise the Html text is displayed as plain text.

View File

@ -32,6 +32,7 @@
#include <wx/log.h> #include <wx/log.h>
#include <wx/app.h> #include <wx/app.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/msgdlg.h>
#include <filehistory.h> #include <filehistory.h>
#include <hotkeys_basic.h> #include <hotkeys_basic.h>
@ -45,6 +46,10 @@
#include "kicad_manager_frame.h" #include "kicad_manager_frame.h"
#include "kicad_settings.h" #include "kicad_settings.h"
#if defined( _WIN32 )
#include <config.h>
#include <VersionHelpers.h>
#endif
// a dummy to quiet linking with EDA_BASE_FRAME::config(); // a dummy to quiet linking with EDA_BASE_FRAME::config();
#include <kiface_i.h> #include <kiface_i.h>
@ -263,6 +268,20 @@ struct APP_KICAD : public wxApp
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF ); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF );
#endif #endif
#if defined( _WIN32 ) && defined( PYTHON_VERSION_MAJOR ) \
&& ( ( PYTHON_VERSION_MAJOR == 3 && PYTHON_VERSION_MINOR >= 8 ) \
|| PYTHON_VERSION_MAJOR > 3 )
// Python 3.8 switched to Windows 8+ API, we do not support Windows 7 and will not attempt to hack around it
// Gracefully inform the user and refuse to start (because python will crash us if we continue)
if( !IsWindows8OrGreater() )
{
wxMessageBox( _( "Windows 7 and older is no longer supported by KiCad and it's dependencies." ),
_( "Unsupported Operating System" ), wxOK | wxICON_ERROR );
return false;
}
#endif
if( !program.OnPgmInit() ) if( !program.OnPgmInit() )
{ {
program.OnPgmExit(); program.OnPgmExit();