Browse Source

Set PYTHONPATH internally for macOS run from build dir

newinvert
Marek Roszko 2 years ago
parent
commit
e5f1cfd2b2
  1. 2
      cmake/config.h.cmake
  2. 7
      scripting/python_scripting.cpp

2
cmake/config.h.cmake

@ -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@"

7
scripting/python_scripting.cpp

@ -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 );

Loading…
Cancel
Save