[MacOSX] support for plugins in the bundle

This commit is contained in:
Marco Serantoni 2014-02-15 11:01:27 +01:00
parent d5064b98a4
commit fb9e5b94ca
3 changed files with 18 additions and 7 deletions

View File

@ -607,6 +607,13 @@ if( KICAD_SCRIPTING )
DEPENDS FixSwigImportsScripting _pcbnew_py_copy
COMMENT "Copying wxPython into pcbnew.app Framework"
)
add_custom_target( pcbnew_copy_plugins ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/PlugIns/scripting/plugins
DEPENDS pcbnew_copy_wxpython_scripting
COMMENT "Copying plugins into bundle"
)
# fix bundle after copying wxpython, fixing and copying
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting )
endif()
@ -636,10 +643,11 @@ if( KICAD_SCRIPTING_MODULES )
)
add_custom_target( pcbnew_copy_wxpython_module ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython
DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy
COMMENT "Copying wxPython into pcbnew.app Frameworks"
)
# Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_module )
add_dependencies( osx_fix_bundles _pcbnew )

View File

@ -170,11 +170,11 @@ bool EDA_APP::OnInit()
// Prepend in PYTHONPATH the content of the bundle libraries !
wxSetEnv("PYTHONPATH",((wxGetenv("PYTHONPATH") != NULL ) ? (wxString(wxGetenv("PYTHONPATH")) + ":") : wxString("")) +
"/Library/Application Support/kicad/scripting" + ":" +
bundledir.GetPath() + "/PlugIns" + ":" +
wxString( wxGetenv("HOME") ) + "/Library/Application Support/kicad/scripting" +
bundledir.GetPath() +
"/Frameworks/wxPython/lib/python2.6/site-packages/wx-3.0-osx_cocoa"
"/Frameworks/wxPython/lib/python2.6/site-packages/wx-3.0-osx_cocoa" + ":" +
"/Library/Application Support/kicad/" + ":" +
bundledir.GetPath() + "/PlugIns" + ":" +
wxString( wxGetenv("HOME") ) + "/Library/Application Support/kicad/"
);
#endif
#endif

View File

@ -80,11 +80,14 @@ def LoadPlugins( plugpath ):
if kicad_path and os.path.isdir(kicad_path):
plugin_directories.append(os.path.join(kicad_path, 'scripting', 'plugins'))
if sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
if sys.platform.startswith('linux'):
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:
if os.path.isdir( os.path.join( singlepath, 'scripting', 'plugins') ):
plugin_directories.append( os.path.join( singlepath, 'scripting', 'plugins') )
for plugins_dir in plugin_directories:
sys.path.append(plugins_dir)