← Back to team overview

kicad-developers team mailing list archive

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


Le 23/06/2017 à 16:11, Jean-Samuel Reynaud a écrit :
> Hi Jean-Pierre,
> Very strange, It look like a python parse error but I can't reproduce
> under Linux. Could you also confirm that python shell is not working
> when patch is applied ?

Hi Jean-Samuel,

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.

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.


Jean-Pierre CHARRAS

Follow ups