Fix launching from the build dir after new_python

This commit is contained in:
Jon Evans 2021-06-01 21:37:33 -04:00
parent 45d1684bbe
commit 148ac19386
1 changed files with 10 additions and 2 deletions

View File

@ -163,8 +163,16 @@ bool SCRIPTING::scriptingSetup()
#else
wxString pypath;
// PYTHON_DEST is the scripts install dir as determined by the build system.
pypath = Pgm().GetExecutablePath() + wxT( "../" PYTHON_DEST );
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
{
// When running from build dir, python module gets built next to pcbnew binary
pypath = Pgm().GetExecutablePath() + wxT( "../pcbnew" );
}
else
{
// PYTHON_DEST is the scripts install dir as determined by the build system.
pypath = Pgm().GetExecutablePath() + wxT( "../" PYTHON_DEST );
}
if( !wxIsEmpty( wxGetenv( wxT( "PYTHONPATH" ) ) ) )
pypath = wxString( wxGetenv( wxT( "PYTHONPATH" ) ) ) + wxT( ":" ) + pypath;