Pcbnew, compiled with python support: Under windows, force python environment, if the folder python27_us is found in Kicad bin folder (<kicad>/bin, and if python27_us environment is not fully set (i.e. if python27_us is not in the path, or if PYTHONPATH id not defined.)
This commit is contained in:
parent
28b9317640
commit
a7c553b442
|
@ -114,6 +114,35 @@ bool EDA_APP::OnInit()
|
|||
#ifdef KICAD_SCRIPTING
|
||||
msg.Empty();
|
||||
#ifdef __WINDOWS__
|
||||
// force python environment under Windows:
|
||||
const wxString python_us("python27_us");
|
||||
|
||||
// Build our python path inside kicad
|
||||
wxString kipython = m_BinDir + python_us;
|
||||
|
||||
// If our python install is existing inside kicad, use it
|
||||
if( wxDirExists( kipython ) )
|
||||
{
|
||||
wxString ppath;
|
||||
if( !wxGetEnv( wxT( "PYTHONPATH" ), &ppath ) || !ppath.Contains( python_us ) )
|
||||
{
|
||||
ppath << kipython << wxT("/pylib;");
|
||||
ppath << kipython << wxT("/lib;");
|
||||
ppath << kipython << wxT("/dll");
|
||||
wxSetEnv( wxT( "PYTHONPATH" ), ppath );
|
||||
DBG( std::cout << "set PYTHONPATH to " << TO_UTF8(ppath) << "\n"; )
|
||||
|
||||
// Add python executable path:
|
||||
wxGetEnv( wxT( "PATH" ), &ppath );
|
||||
if( !ppath.Contains( python_us ) )
|
||||
{
|
||||
kipython << wxT(";") << ppath;
|
||||
wxSetEnv( wxT( "PATH" ), kipython );
|
||||
DBG( std::cout << "set PATH to " << TO_UTF8(kipython) << "\n"; )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make this path definable by the user, and set more than one path
|
||||
// (and remove the fixed paths from <src>/scripting/kicadplugins.i)
|
||||
|
||||
|
|
Loading…
Reference in New Issue