Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1671 closed defect (fixed)

grass/script/setup.py errors

Reported by: artegion Owned by: martinl
Priority: major Milestone: 6.4.3
Component: Python Version: 6.4.2
Keywords: setup Cc: grass-dev@…
CPU: Unspecified Platform: All

Description

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)                

Change History (4)

comment:1 by martinl, 12 years ago

Cc: grass-dev@… added
Keywords: setup added
Owner: changed from grass-dev@… to martinl
Status: newassigned

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

Martin

in reply to:  1 ; comment:2 by glynn, 12 years ago

Replying to 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.

in reply to:  2 ; comment:3 by martinl, 12 years ago

Resolution: fixed
Status: assignedclosed

Replying to glynn:

Replying to 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.

in reply to:  3 comment:4 by martinl, 12 years ago

OK, removed in r53313. Closing.

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

Note: See TracTickets for help on using tickets.