[GRASS-dev] Re: [GRASS GIS] #580: WinGRASS:
$GISBASE/etc/gui/scripts/ require something like $(EXE) to run
GRASS GIS
trac at osgeo.org
Tue Oct 6 04:46:30 EDT 2009
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by glynn):
Replying to [comment:12 cmbarton]:
> > On Windows, 6.4's g.parser explicitly invokes the script via
$GRASS_SH. Obviously this won't work for Python scripts.
>
> Does this mean that it is only expecting shell scripts in Windows?
Yes. Windows doesn't understand shebang lines, so g.parser can't "run" the
shell scripts as if they were executables; it has to use "$GRASS_SH
<script>".
It might be possible to use "$GRASS_SH -c <script>", as MSys' bash
understands shebang lines. OTOH, for "#!/usr/bin/env python", this will
only work if there is an executable named "python" in the path (if it's
called e.g. "python25" or it isn't in the path, you lose).
Alternatively, the scripts could be installed with a ".sh" extension,
relying upon the file associations to run such scripts via bash.
Or you could make g.parser examine the first line of the script and choose
a suitable interpreter (it isn't as simple as processing a shebang on Unix
as we don't know where MSys' virtual filesystem is located and we can't
assume that the "#!/usr/bin/env" trick will work with "native"
interpreters).
> What happens on other platforms (since Python does run without problems
in Linux and on Mac)?
The code to re-invoke the script is conditionalised upon "#ifdef
!__MINGW32!__". Unix (including MacOSX) simply execl()s the script
directly, while the Windows version invokes it via $GRASS_SH.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/580#comment:13>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list