Commit fb9e5b94 authored by Marco Serantoni's avatar Marco Serantoni

[MacOSX] support for plugins in the bundle

parent d5064b98
...@@ -607,6 +607,13 @@ if( KICAD_SCRIPTING ) ...@@ -607,6 +607,13 @@ if( KICAD_SCRIPTING )
DEPENDS FixSwigImportsScripting _pcbnew_py_copy DEPENDS FixSwigImportsScripting _pcbnew_py_copy
COMMENT "Copying wxPython into pcbnew.app Framework" 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 # fix bundle after copying wxpython, fixing and copying
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting ) add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting )
endif() endif()
...@@ -636,10 +643,11 @@ if( KICAD_SCRIPTING_MODULES ) ...@@ -636,10 +643,11 @@ if( KICAD_SCRIPTING_MODULES )
) )
add_custom_target( pcbnew_copy_wxpython_module ALL 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 DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy
COMMENT "Copying wxPython into pcbnew.app Frameworks" COMMENT "Copying wxPython into pcbnew.app Frameworks"
) )
# Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython # 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_copy_wxpython_module )
add_dependencies( osx_fix_bundles _pcbnew ) add_dependencies( osx_fix_bundles _pcbnew )
......
...@@ -170,11 +170,11 @@ bool EDA_APP::OnInit() ...@@ -170,11 +170,11 @@ bool EDA_APP::OnInit()
// Prepend in PYTHONPATH the content of the bundle libraries ! // Prepend in PYTHONPATH the content of the bundle libraries !
wxSetEnv("PYTHONPATH",((wxGetenv("PYTHONPATH") != NULL ) ? (wxString(wxGetenv("PYTHONPATH")) + ":") : wxString("")) + 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() + 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
#endif #endif
......
...@@ -80,11 +80,14 @@ def LoadPlugins( plugpath ): ...@@ -80,11 +80,14 @@ def LoadPlugins( plugpath ):
if kicad_path and os.path.isdir(kicad_path): if kicad_path and os.path.isdir(kicad_path):
plugin_directories.append(os.path.join(kicad_path, 'scripting', 'plugins')) 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_plugins/')
plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/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: for plugins_dir in plugin_directories:
sys.path.append(plugins_dir) sys.path.append(plugins_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment