← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix wrong directory building for python plugins

 

Hi,
Just my 2 cents following down below

> I committed your patch, and added the handling of broken python scripts in subdirs, and handling of
> non python subdir (like subdirs containing .xsl files only)
> 
> Please test it.

Is it in the master branch of KiCad (i.e. can I test it by updating from
the nightly ubuntu PPA on launchpad by jsrenaud?)
> 
> I had issues because I tested your patch (that was not broken) on a Window install, having subdirs
> in <kicad>\share\kicad\scripting\plugins.
> All scripts are working, but all scripts are not python scripts.
> These subdirs have subdirs and contain also .xsl scripts.

May I ask why the kicad scripting directory contains xsl scripts?

> I am still thinking the current way to handle pythons scripts in subdirs is really broken because:

I don't agree at all

> - subdirs in subdirs are not handled: this is a heavy limitation.

They are handled as they should be: private to a "complex style plugin"
(as described by the plugin documentation I wrote). If you add subdirs
to such a plugin, you can import it yourself within your plugin using
"from <subdir> import <stuff>".
And that is, what it should do. What it should not do is scan deeper
than one level for plugins.

> - subdirs containing .xsl scripts are not smartly handled

May I ask what they are for?
> - the need to add and configure __init__.py in subdir is for now a workaround, but not really
> acceptable for most of users, who just copy pythons scripts in a suitable subdir (the natural way to
> add and manage pythons scripts)

I don't get you. Why is it a workaround?
Why do you want to organize the plugin into multiple subdirs? This
organization in no way translates to any structure within Pcbnew (i.e.
everything gets added to the Tools->External Plugins Menu without
hierarchy) and would be of very limited use.

> I'll be really happy if someone could have a look into this loading mechanism, and find a better way
> to load python scripts (Remember I have a poor knowledge of Python).

I guess first we have to really agree on how we want the loading
mechanism to work, what features it should or should not have.

Best Regards
Simon


Follow ups

References