Set PYTHONPATH internally for macOS run from build dir

This commit is contained in:
Marek Roszko 2023-11-13 23:08:53 -05:00
parent 53a90ccb88
commit e5f1cfd2b2
2 changed files with 9 additions and 0 deletions

View File

@ -91,6 +91,8 @@
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
#define PYTHON_SITE_PACKAGE_PATH "@PYTHON_SITE_PACKAGE_PATH@"
/// Allows scripts install directory to be referenced by the program code.
#define KICAD_DATA "@KICAD_DATA@"

View File

@ -281,6 +281,13 @@ bool SCRIPTING::scriptingSetup()
pypath = wxString( wxGetenv( wxT( "PYTHONPATH" ) ) ) + wxT( ":" ) + pypath;
}
// Hack for run from build dir option
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
{
pypath = wxString( wxT( PYTHON_SITE_PACKAGE_PATH ) ) + wxT( "/../:" )
+ wxT( PYTHON_SITE_PACKAGE_PATH ) + wxT( ":" ) + wxT( PYTHON_DEST );
}
// set $PYTHONPATH
wxSetEnv( wxT( "PYTHONPATH" ), pypath );