Minor scripting improvements and code cleaning.

* Coding policy fixes in the scripting initialization code missed in my previous commit.
* Remove redundant checks for valid Python library paths in kicadplugins.i.
This commit is contained in:
Wayne Stambaugh 2015-10-01 20:15:01 -04:00
parent 28bda90e87
commit 053458b81a
2 changed files with 11 additions and 12 deletions

View File

@ -207,7 +207,7 @@ static bool scriptingSetup()
#if defined( __MINGW32__ )
// force python environment under Windows:
const wxString python_us( "python27_us" );
const wxString python_us( wxT( "python27_us" ) );
// Build our python path inside kicad
wxString kipython = FindKicadFile( python_us + wxT( "/python.exe" ) );
@ -281,15 +281,15 @@ static bool scriptingSetup()
wxSetEnv( "PYTHONPATH", pypath );
#else
/* Linux-specific setup */
// Linux-specific setup
wxString pypath;
pypath = Pgm().GetExecutablePath() + wxT( "../lib/python2.7/dist-packages" );
if( !wxIsEmpty( wxGetenv("PYTHONPATH") ) )
pypath = wxString( wxGetenv("PYTHONPATH") ) + wxT( ":" ) + pypath;
if( !wxIsEmpty( wxGetenv( wxT( "PYTHONPATH" ) ) )
pypath = wxString( wxGetenv( wxT( "PYTHONPATH" ) ) ) + wxT( ":" ) + pypath;
wxSetEnv( "PYTHONPATH", pypath );
wxSetEnv( wxT( "PYTHONPATH" ), pypath );
// Add this default search path:
path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" );

View File

@ -85,10 +85,10 @@ def LoadPlugins( plugpath ):
kicad_path = os.environ.get('KICAD_PATH')
plugin_directories=[]
if plugpath and os.path.isdir( plugpath ):
if plugpath:
plugin_directories.append(plugpath)
if kicad_path and os.path.isdir(kicad_path):
if kicad_path:
plugin_directories.append(os.path.join(kicad_path, 'scripting', 'plugins'))
if sys.platform.startswith('linux'):
@ -97,7 +97,6 @@ def LoadPlugins( plugpath ):
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: