[GRASS-dev] Re: [GRASS GIS] #1101: WinGrass7 + scripts are not found in the command line

GRASS GIS trac at osgeo.org
Wed Sep 21 14:04:52 EDT 2011


#1101: WinGrass7 + scripts are not  found in the command line
-------------------------------+--------------------------------------------
 Reporter:  hellik             |       Owner:  grass-dev@…              
     Type:  defect             |      Status:  new                      
 Priority:  normal             |   Milestone:  7.0.0                    
Component:  Packaging          |     Version:  svn-trunk                
 Keywords:  wingrass, scripts  |    Platform:  MSWindows Vista          
      Cpu:  Unspecified        |  
-------------------------------+--------------------------------------------

Comment(by glynn):

 Replying to [comment:12 martinl]:

 > >  2. Does PATHEXT include ".PY"?
 >
 > yes

 > When I type
 >
 {{{
 g.manual
 }}}
 >
 > -> `command not found`
 >
 > Of course
 >
 {{{
 g.manual.py
 }}}
 >
 > works.

 I'm forgetting that we're dealing with bash here. bash ignores PATHEXT,
 and it doesn't use file extensions either (except perhaps .bat?).

 OTOH, cmd.exe uses PATHEXT and file extensions but ignores the shebang.
 And, on Windows, GRASS' G_spawn(), C's system() and Python's os.system()
 and subprocess.Popen() all use cmd.exe, not bash.

 If we want Python scripts to work in bash, I suspect that we'll need to
 create shell-script wrappers without the .py extension which invoke the
 script via e.g. $GRASS_PYTHON. Or just require users to type the ".py"
 when running scripts from a shell. Or, if we're only interested in shells
 which are started by GRASS, we can customise the .bashrc file to define
 aliases for all of the Python scripts, e.g.:
 {{{
 alias g.manual='"$GRASS_PYTHON" "$GISBASE/scripts/g.manual.py"'
 ...
 }}}

 Ultimately, using bash on Windows is always going to be a pain; it's a
 struggle just to achieve "adequate", and almost impossible to go beyond
 that. But I don't know whether bash support really matters to actual
 Windows users (as opposed to GRASS developers who are running WinGRASS
 solely for testing purposes).

 The priority should be to ensure that "native" support works, i.e.
 invoking scripts from the GUI, cmd.exe, Python scripts and C programs.
 Personally, I'd prefer it if Windows+bash support was limited to
 information on the Wiki, so that users understand that it's a "use at your
 own risk" feature.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1101#comment:13>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list