[GRASS-dev] Setting of GRASS_ADDON_PATH in grass.py has a "code smell"

Vaclav Petras wenzeslaus at gmail.com
Wed May 20 20:31:13 PDT 2015


Hi,


when analyzed with Pylint [1, 2] the function set_paths() in grass.py [3]
triggers an unused variable warning in the following block of code:


addon_path = os.getenv('GRASS_ADDON_PATH')

if addon_path:

    for path in addon_path.split(os.pathsep):

        path_prepend(addon_path, 'PATH')


Is this an intention or a mistake?


I would say that a mistake but since I don't remember any complains about
not working addons with multiple paths (which, I think, happens when you
run script from GUI). Actually, now I remember that I might have seen addon
paths duplicated in the PATH variable which is exactly what the code does.


Thanks,

Vaclav


[1] http://grasswiki.osgeo.org/wiki/Tools_for_Python_programming

[2] http://trac.osgeo.org/grass/browser/grass/trunk/tools/pylintrc.txt

[3] https://trac.osgeo.org/grass/browser/grass/trunk/lib/init/grass.py#L503
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150520/ae677353/attachment.html>


More information about the grass-dev mailing list