diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 63f4b4a74b..bc010d8426 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -252,20 +252,31 @@ static bool scriptingSetup() path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" ); #elif defined( __WXMAC__ ) - // User plugin folder is ~/Library/Application Support/kicad/scripting/plugins - path_frag = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" ); + // TODO: + // For scripting currently only the bundle scripting path and the path + // defined by $(KICAD_PATH)/scripting/plugins is defined. + // These paths are defined here and in kicadplugins.i + // In future, probably more paths are of interest: + // * User folder (~/Library/Application Support/kicad/scripting/plugins) + // => GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" ); + // * Machine folder (/Library/Application Support/kicad/scripting/plugins) + // => GetOSXKicadMachineDataDir() + wxT( "/scripting/plugins" ); + + // This path is given to LoadPlugins() from kicadplugins.i, which + // only supports one path. Only use bundle scripting path for now. + path_frag = GetOSXKicadDataDir() + wxT( "/scripting/plugins" ); // Add default paths to PYTHONPATH wxString pypath; - // User scripting folder (~/Library/Application Support/kicad/scripting/plugins) - pypath = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" ); - - // Machine scripting folder (/Library/Application Support/kicad/scripting/plugins) - pypath += wxT( ":" ) + GetOSXKicadMachineDataDir() + wxT( "/scripting/plugins" ); - // Bundle scripting folder (/Contents/SharedSupport/scripting/plugins) - pypath += wxT( ":" ) + GetOSXKicadDataDir() + wxT( "/scripting/plugins" ); + pypath += GetOSXKicadDataDir() + wxT( "/scripting/plugins" ); + + // $(KICAD_PATH)/scripting/plugins is always added in kicadplugins.i + if( wxGetenv("KICAD_PATH") != NULL ) + { + pypath += wxT( ":" ) + wxString( wxGetenv("KICAD_PATH") ); + } // Bundle wxPython folder (/Contents/Frameworks/python/site-packages) pypath += wxT( ":" ) + Pgm().GetExecutablePath() + diff --git a/scripting/kicadplugins.i b/scripting/kicadplugins.i index 6f8aff4676..0ba34d3cad 100644 --- a/scripting/kicadplugins.i +++ b/scripting/kicadplugins.i @@ -95,10 +95,6 @@ def LoadPlugins(plugpath): plugin_directories.append(os.environ['HOME']+'/.kicad_plugins/') plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/plugins/') - if sys.platform.startswith('darwin'): - for singlepath in sys.path: - plugin_directories.append(os.path.join( singlepath, 'scripting', 'plugins')) - for plugins_dir in plugin_directories: if not os.path.isdir(plugins_dir): continue