[GRASS-dev] [GRASS-SVN] r67282 - grass/trunk/lib/python/script

Vaclav Petras wenzeslaus at gmail.com
Mon Dec 21 06:33:49 PST 2015


Hi Martin,

On Sun, Dec 20, 2015 at 10:04 AM, <svn_grass at osgeo.org> wrote:

> Author: martinl
> Date: 2015-12-20 07:04:40 -0800 (Sun, 20 Dec 2015)
> New Revision: 67282
>
> Modified:
>    grass/trunk/lib/python/script/setup.py
> Log:
> pythonlib: add wxpython modules to pythonpath when calling gsetup.init()
>
>
> Modified: grass/trunk/lib/python/script/setup.py
> ===================================================================
> --- grass/trunk/lib/python/script/setup.py      2015-12-20 13:51:21 UTC
> (rev 67281)
> +++ grass/trunk/lib/python/script/setup.py      2015-12-20 15:04:40 UTC
> (rev 67282)
> @@ -174,7 +174,7 @@
>      # Set PYTHONPATH to find GRASS Python modules
>      # TODO: isn't this useless? user already imported this somehow
>      path = os.getenv('PYTHONPATH')
> -    etcpy = os.path.join(gisbase, 'etc', 'python')
> +    etcpy = os.path.join(gisbase, 'etc', 'python') + os.pathsep +
> os.path.join(gisbase, 'gui', 'wxpython')
>      if path:
>          path = etcpy + os.pathsep + path
>      else:
>

I think this is too risky. If I understand it correctly, it puts all the
GUI modules/packages on path. So, one will get:

animation
core
datacatalog
dbmgr
docs
gcp
...

Considering the amount and naming, it is likely to get name collision. This
will happen even if the caller doesn't have any interest in GUI.

Simple way to solve this would be adding GUI to path optionally by a
parameter or by providing a separate function.

Better way to solve this is probably putting GUI modules/packages to a
bigger package. Let's say grassgui, or perhaps grasswxgui. Another option
is to have grass.wxgui package. In this case, putting things to etc/python/
would be mandatory, in the other cases it is optional.

Vaclav

https://trac.osgeo.org/grass/changeset/67282
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20151221/8efc3158/attachment.html>


More information about the grass-dev mailing list