Commit a7c553b4 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew, compiled with python support: Under windows, force python environment,...

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.)
parent 28b93176
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment