← Back to team overview

kicad-developers team mailing list archive

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

 

Hi,

> I found what happens:
> Your patch has removed a bug in a bug!
> 
> Here is the broken code, line 157, added in commit 5d0dee1364a7b7bc6f692e2f4fc898da9f24e987:
> 
> old code:
> if os.path.isdir(plugins_dir+module):
> 	__import__(module, locals(), globals())
> 
> plugins_dir+module dir name never exists.

Why not. Can you elaborate?

> new code:
> if os.path.isdir(os.path.join(plugins_dir,module)):
> 	__import__(module, locals(), globals())
> 
> Now, if a subdir exists in a plugins_dir (it was the case in my install),
> __import__(module, locals(), globals()) is executed.
> But, for me, this code makes no sense: I do not even understand the purpose of the code.
> (however I am not a Python specialist, and to tell the Truth, my knowledge in Python is near zilch).
> 
> So I am inclined to remove this code (which was previously never executed) and commit your patch.

Are you suggesting to remove importing directory-based Pcbnew plugins?
If so, I would strongly suggest against it.
See here.
https://github.com/KiCad/kicad-source-mirror/compare/master...skuep:devel?short_path=8efcfb4#diff-8efcfb4e0c1a503ca34f0304450b9dc6

"Complex Plugin Example"

I also use it in my action_viafence Pcbnew plugin here.
https://github.com/skuep/kicad-plugins

Best Regards
Simon


References