Browse Source

Adjust macOS BOM plugin Python path

6.0.7
Adam Wolf 4 years ago
committed by Seth Hillbrand
parent
commit
4fd5c9cfa8
  1. 26
      eeschema/bom_plugins.cpp

26
eeschema/bom_plugins.cpp

@ -72,11 +72,33 @@ BOM_GENERATOR_HANDLER::BOM_GENERATOR_HANDLER( const wxString& aFile )
m_file.GetPath(),
m_file.GetFullName(),
getOutputExtension( m_info ) );
#else
// For macOS, we want to use the Python we bundle along, rather than just PYTHON_EXECUTABLE.
// For non-Windows, non-macOS, we can call out to PYTHON_EXECUTABLE.
#ifdef __APPLE__
// python is at Contents/Frameworks/Python.framework/Versions/Current/bin/python3
// Of course, for macOS, it's not quite that simple, since the relative path
// will depend on if we are in standalone mode or not.
// (If we're going to call out to python like this in other places, we probably want to
// think about pulling this into PATHS.)
wxFileName python( PATHS::GetOSXKicadDataDir(), wxEmptyString );
python.RemoveLastDir();
python.AppendDir( wxT( "Frameworks" ) );
python.AppendDir( wxT( "Python.framework" ) );
python.AppendDir( wxT( "Versions" ) );
python.AppendDir( wxT( "Current" ) );
python.AppendDir( wxT( "bin" ) );
python.SetFullName(wxT( "python3" ) );
wxString interpreter = python.GetFullPath();
#else
wxString interpreter = wxString::FromUTF8Unchecked( PYTHON_EXECUTABLE );
#endif
if( interpreter.IsEmpty() )
interpreter = wxT( "python" );
interpreter = wxT( "python" ); // For macOS, should we log here? Error here?
m_cmd = wxString::Format( "%s \"%s\" \"%%I\" \"%%O%s\"",
interpreter,

Loading…
Cancel
Save