Avoid loading python stuff when starting applications that do not use it.
It is useless, and debug is slightly easier (less constraints) at least on msys2
This commit is contained in:
parent
8f30404e42
commit
60c65c2a1d
|
@ -198,7 +198,7 @@ const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEdit
|
|||
}
|
||||
|
||||
|
||||
bool PGM_BASE::InitPgm( bool aHeadless )
|
||||
bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit )
|
||||
{
|
||||
wxString pgm_name = wxFileName( App().argv[0] ).GetName().Lower();
|
||||
|
||||
|
@ -272,7 +272,10 @@ bool PGM_BASE::InitPgm( bool aHeadless )
|
|||
|
||||
ReadPdfBrowserInfos(); // needs GetCommonSettings()
|
||||
|
||||
m_python_scripting = std::make_unique<SCRIPTING>();
|
||||
// Create the python scripting stuff
|
||||
// Skip it fot applications that do not use it
|
||||
if( !aSkipPyInit )
|
||||
m_python_scripting = std::make_unique<SCRIPTING>();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Always show filters on Open dialog to be able to choose plugin
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2014-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -281,7 +281,15 @@ bool PGM_SINGLE_TOP::OnPgmInit()
|
|||
}
|
||||
#endif
|
||||
|
||||
if( !InitPgm() )
|
||||
// Not all kicad applications use the python stuff. skip python init
|
||||
// for these apps.
|
||||
bool skip_python_initialization = false;
|
||||
#if defined( BITMAP_2_CMP ) || defined( PL_EDITOR ) || defined( GERBVIEW ) ||\
|
||||
defined( PCB_CALCULATOR_BUILD )
|
||||
skip_python_initialization = true;
|
||||
#endif
|
||||
|
||||
if( !InitPgm( false, skip_python_initialization ) )
|
||||
{
|
||||
// Clean up
|
||||
OnPgmExit();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -269,9 +269,11 @@ public:
|
|||
* @note Do not initialize anything relating to DSOs or projects.
|
||||
*
|
||||
* @param aHeadless If true, run in headless mode (e.g. for unit tests)
|
||||
* @param aSkipPyInit If true, do not init python stuff.
|
||||
* Useful in application that do not use python, to disable python dependency at run time
|
||||
* @return true if success, false if failure and program is to terminate.
|
||||
*/
|
||||
bool InitPgm( bool aHeadless = false );
|
||||
bool InitPgm( bool aHeadless = false, bool aSkipPyInit = false );
|
||||
|
||||
// The PGM_* classes can have difficulties at termination if they
|
||||
// are not destroyed soon enough. Relying on a static destructor can be
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
add_definitions(-DPCB_CALCULATOR_BUILD)
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
dialogs
|
||||
|
|
Loading…
Reference in New Issue