[GRASS-dev] v.type.sh question - important for 6.4 release

Glynn Clements glynn at gclements.plus.com
Wed Mar 11 15:10:17 EDT 2009


Michael Barton wrote:

> >> Because the way that v.type works makes it unusable in a GUI, Hamish
> >> wrote a script wrapper that DOES work in the GUI. Logically, it is
> >> placed in $GISBASE/etc/gui/scripts.
> >>
> >> However, windows cannot execute it there. I'm not sure if it is
> >> because it needs to have a *.exe put on the end or because it DOES
> >> have a *.exe and the GUI doesn't reference it correctly. I'm not sure
> >> if it just needs to be renamed (i.e., drop the .sh), or moved to the
> >> main $GISBASE/script directory, or what. But I bet that it is pretty
> >> easy to fix this for windows. I just don't know what to do.
> >>
> >> If someone could offer advice, I could get it working for the 6.4
> >> release.
> >
> > The way that we normally make shell scripts work on Windows is to
> > provide a .bat file which explicitly invokes the script via $GRASS_SH.
> >
> > On Windows, the $GISBASE/bin directory will contain a .bat file for
> > each script in the $GISBASE/scripts directory. These are created using
> > the scripts/windows_launch.bat file as a template.
> >
> > It may suffice to add $GISBASE/etc/gui/scripts/v.type.sh.bat. If that
> > doesn't work, add an "if windows ..." case to gis.m's "execute"
> > function, which invokes the script via $env(GRASS_SH).
> >
> > --  
> > Glynn Clements <glynn at gclements.plus.com>
> 
> This sounds good. Two questions.
> 
> 1) How can we get the *.bat files to be generated for files in the  
> $GISBASE/ext/gui/scripts folder?

For the scripts in the scripts directory, this is done via the
following rule from Script.make:

$(BIN)/$(PGM).bat: $(MODULE_TOPDIR)/scripts/windows_launch.bat
	sed -e "s#SCRIPT_NAME#$(PGM)#" $(MODULE_TOPDIR)/scripts/windows_launch.bat > $@

For the gui/scripts, the above rule can be generalised to a pattern rule:

$(GISBASE)/etc/gui/scripts/%.bat: $(MODULE_TOPDIR)/scripts/windows_launch.bat
	sed -e "s#SCRIPT_NAME#$*#" $(MODULE_TOPDIR)/scripts/windows_launch.bat > $@

You then need to "make" the relevant .bat files with e.g.:

	for file in *.* ; do $(MAKE) $(GISBASE)/etc/gui/scripts/$$file.bat ; done

> 2) Can v.type.sh.bat be called by just specifying v.type.sh? Or do you  
> need to fully specify the *.bat extension?

Just using the base name seems to work for everything else, although I
can't exclude the possibility that Tcl behaves differently depending
upon whether a full path is used (it's actually Tcl which tries the
.exe and .bat suffixes; it doesn't use Windows' ShellExecute()).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list