[GRASS-dev] [GRASS GIS] #1671: grass/script/setup.py errors

#1671: grass/script/setup.py errors
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: Python | Version: 6.4.2
Keywords: | Platform: All
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
grass/script/setup.py needs a {{{os.pathsep}}} at this line

{{{
     ## os.environ['PATH'] += os.path.join(gisbase, 'lib') ##WRONG##
     os.environ['PATH'] += os.pathsep + os.path.join(gisbase, 'lib')
}}}

then $GISBASE/extralib and $GISBASE/msys/bin are missed in PATH (for
windows only)
{{{
     ## added for winGrass
     if sys.platform.startswith('win'):
          os.environ['PATH'] += os.pathsep + os.path.join(gisbase,
'extralib')
          os.environ['PATH'] += os.pathsep + os.path.join(gisbase,
'msys','bin')
}}}

of course we need
{{{import sys}}}
at the beginning

Another point ----
From outside Grass Gis we '''must''' define $GISBASE, $GISRC and add
$GISBASE/etc/python to sys.path BEFORE import anything from grass
(I did'nt find anything about this in Programmer's Manual)

{{{
...
os.environ['GISBASE'] =gisbase

grass_python_dir= os.path.join(gisbase, 'etc','python')
if os.path.isdir(os.path.join(grass_python_dir,'grass')):
     sys.path.append(grass_python_dir)
else:
     raise Exception('etc\python\grass module not found')
os.environ['GISRC']= 'junk'
from grass.script import setup
gisrc= setup.init(os.getenv('GISBASE'),gisdb,location,mapset)

...

os.remove(gisrc)
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1671&gt;
GRASS GIS <http://grass.osgeo.org>

#1671: grass/script/setup.py errors
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.3
Component: Python | Version: 6.4.2
Keywords: setup | Platform: All
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

* cc: grass-dev@… (added)
  * keywords: => setup
  * status: new => assigned
  * owner: grass-dev@… => martinl

Comment:

Suggested changes applied in r52000 (trunk) and r52001 (devbr6), Backport
for relbr64 requires some testing.

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1671#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1671: grass/script/setup.py errors
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.4.3
Component: Python | Version: 6.4.2
Keywords: setup | Platform: All
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by glynn):

Replying to [comment:1 martinl]:
> Suggested changes applied in r52000 (trunk)
{{{
os.environ['PATH'] += os.pathsep + os.path.join(gisbase, 'msys', 'bin')
}}}
This doesn't belong in GRASS 7.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1671#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1671: grass/script/setup.py errors
-----------------------+----------------------------------------------------
  Reporter: artegion | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.3
Component: Python | Version: 6.4.2
Resolution: fixed | Keywords: setup
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by martinl):

  * status: assigned => closed
  * resolution: => fixed

Comment:

Replying to [comment:2 glynn]:
> Replying to [comment:1 martinl]:
> > Suggested changes applied in r52000 (trunk)
{{{
> os.environ['PATH'] += os.pathsep + os.path.join(gisbase, 'msys', 'bin')
}}}
> This doesn't belong in GRASS 7.

OK, removed in r53313. Closing.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1671#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1671: grass/script/setup.py errors
-----------------------+----------------------------------------------------
  Reporter: artegion | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.3
Component: Python | Version: 6.4.2
Resolution: fixed | Keywords: setup
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------

Comment(by martinl):

> OK, removed in r53313. Closing.

Forgot to mention that the fix has been backported to relbr64 in r53314.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1671#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>