[GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?

Good evening and happy weekend!
I am (still) upgrading from 6.4.4 to 7.0.3 and I discovered that the vector topography of all my data is not upwards compatible so per the instructions at https://grasswiki.osgeo.org/wiki/Convert_all_GRASS_6_vector_maps_to_GRASS_7 I am (trying) to us v.build.all to update the topography. I had installed GRASS with MSYS from OSGEO4W but that goodness uses the unix-like msys shell as the command console - which for what I need is perfect ... I can copy/paste commands to test as I write shell scripts to do GIS magic. BUT ... go ahead and try to run v.build.all ... and nope - it isn't going to let you. Ends up v.build.all (and many other modules) are Windows Batch files !! the msys command console won't run the GRASS modules that are Windows Batch files. I was able to work around this a little issue by also installing just the regular GRASS 7.0.3 (they install in different directories) and run the v.build.all from the Windows cmd console (it is the standard command console that runs with "normal" 7.0.3 (not from OSGEO4W) but which won't run any of the code I put into a shell script because, well, it's unix shell not DOS - hence the need for msys)... I was going to drop a note to the OSGEO4W project about the issue but the same thing is part of the current (non-OSGEO4W) package ... look in \Program Files\GRASS GIS 7.0.3\bin\ and you'll see many executables (compiled python scripts I assume) and quite a few Windows Batch files.... why is this? Should they not all be compiled executables ??
I don't understand this and it makes it really hard to create shell scripts to run the modules...
Thanks,
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.
bartolomei.chris@ensco.com

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

Bartolomei.Chris-2 wrote

Good evening and happy weekend!
I am (still) upgrading from 6.4.4 to 7.0.3 and I discovered that the
vector topography of all my data is not upwards compatible so per the
instructions at
https://grasswiki.osgeo.org/wiki/Convert_all_GRASS_6_vector_maps_to_GRASS_7
I am (trying) to us v.build.all to update the topography. I had installed
GRASS with MSYS from OSGEO4W but that goodness uses the unix-like msys
shell as the command console - which for what I need is perfect ... I can
copy/paste commands to test as I write shell scripts to do GIS magic. BUT
... go ahead and try to run v.build.all ... and nope - it isn't going to
let you. Ends up v.build.all (and many other modules) are Windows Batch
files !! the msys command console won't run the GRASS modules that are
Windows Batch files. I was able to work around this a little issue by
also installing just the regular GRASS 7.0.3 (they install in different
directories) and run the v.build.all from the Windows cmd console (it is
the standard command console that runs with "normal" 7.0.3 (not from
OSGEO4W) but which won't run any of the code I put into a shell script
because, well, it's unix shell not DOS - hence the need for msys)... I was
going to drop a note to the OSGEO4W project about the issue but the same
thing is part of the current (non-OSGEO4W) package ... look in \Program
Files\GRASS GIS 7.0.3\bin\ and you'll see many executables (compiled
python scripts I assume) and quite a few Windows Batch files.... why is
this? Should they not all be compiled executables ??
I don't understand this and it makes it really hard to create shell
scripts to run the modules...
Thanks,
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.

bartolomei.chris@

The information contained in this email message is intended only for the
use of the individual(s) to whom it is addressed and may contain
information that is privileged and sensitive. If you are not the intended
recipient, or otherwise have received this communication in error, please
notify the sender immediately by email at the above referenced address and
note that any further dissemination, distribution or copying of this
communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of
technology originating in the United States. This includes the electronic
transmission of information and software to foreign countries and to
certain foreign nationals. Recipient agrees to abide by these laws and
their regulations -- including the U.S. Department of Commerce Export
Administration Regulations and the U.S. Department of State International
Traffic in Arms Regulations -- and not to transfer, by electronic
transmission or otherwise, any content derived from this email to either a
foreign national or a foreign destination in violation of such laws.
_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

the exe files are compiled C/C++ modules.

the bat-files are starting wrapper files for python scripts living in
..\scripts.

These wrapper files are needed as winGRASS standalone/Osgeo4w uses its own
python stack and doesn't use the system wide python.

The scripts in .. \scripts are all python scripts in Grass7, this has
changed from grass6 to grass7. Therefore the starting scripts wrapper
bat-files in .. \bin which point to the scripts in .. \scripts by using the
right python interpreter (have a look into the bat-files).

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/why-is-v-build-all-and-many-others-a-windows-batch-file-and-not-an-executable-tp5263621p5263629.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Ok (I guess) but this causes severe problems running shell scripts that call out the GRASS modules ... there is no way of knowing which modules are compiled executables (which run fine from the shell script) and which ones are Windows Batch files (which DON'T run when called from a script) ... unless you run the script and figure out which modules make it crash. If you look in the bin directory, you'll see a mix of both ... for example r.mask, v.build.all and v.db.addcolumn are Windows Batch files which you can''t run from a shell script - you have to add the "python {path to script}/{script}.py" to run it whereas in the same bin directory v.build, v.clean, r.what, etc are compiled executables.
This is really really (really) bad. There are a lot of legacy shell scripts that will need extensive rewriting for which there are no resources to do. It's bad enough that msys is gone, the topology is no longer valid (have to update all data), a large amount of the module syntax options have changed, and so on ... for me all of this grief is because v.net doesn't snap points to the network and the fix (in v7) won't be ported to v6.4.4 .... They modules should all be compiled executables so legacy shell scripts users have can run them ... please make at least ONE thing about this "upgrade" semi-straightforward. It's been a nightmare.

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.
bartolomei.chris@ensco.com
________________________________________
From: grass-user [grass-user-bounces@lists.osgeo.org] On Behalf Of Helmut Kudrnovsky [hellik@web.de]
Sent: Saturday, April 30, 2016 1:05 AM
To: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?

Bartolomei.Chris-2 wrote

Good evening and happy weekend!
I am (still) upgrading from 6.4.4 to 7.0.3 and I discovered that the
vector topography of all my data is not upwards compatible so per the
instructions at
https://urldefense.proofpoint.com/v2/url?u=https-3A__grasswiki.osgeo.org_wiki_Convert-5Fall-5FGRASS-5F6-5Fvector-5Fmaps-5Fto-5FGRASS-5F7&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=OBfSgl1s_aokN50AbM4hgIa8k--o2IlLBqyw5RqMUhE&s=oC4JyxynBdHD_R4xFz0sx_PQrQbEkquIEGJIHlwZqtk&e=
I am (trying) to us v.build.all to update the topography. I had installed
GRASS with MSYS from OSGEO4W but that goodness uses the unix-like msys
shell as the command console - which for what I need is perfect ... I can
copy/paste commands to test as I write shell scripts to do GIS magic. BUT
... go ahead and try to run v.build.all ... and nope - it isn't going to
let you. Ends up v.build.all (and many other modules) are Windows Batch
files !! the msys command console won't run the GRASS modules that are
Windows Batch files. I was able to work around this a little issue by
also installing just the regular GRASS 7.0.3 (they install in different
directories) and run the v.build.all from the Windows cmd console (it is
the standard command console that runs with "normal" 7.0.3 (not from
OSGEO4W) but which won't run any of the code I put into a shell script
because, well, it's unix shell not DOS - hence the need for msys)... I was
going to drop a note to the OSGEO4W project about the issue but the same
thing is part of the current (non-OSGEO4W) package ... look in \Program
Files\GRASS GIS 7.0.3\bin\ and you'll see many executables (compiled
python scripts I assume) and quite a few Windows Batch files.... why is
this? Should they not all be compiled executables ??
I don't understand this and it makes it really hard to create shell
scripts to run the modules...
Thanks,
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.

bartolomei.chris@

The information contained in this email message is intended only for the
use of the individual(s) to whom it is addressed and may contain
information that is privileged and sensitive. If you are not the intended
recipient, or otherwise have received this communication in error, please
notify the sender immediately by email at the above referenced address and
note that any further dissemination, distribution or copying of this
communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of
technology originating in the United States. This includes the electronic
transmission of information and software to foreign countries and to
certain foreign nationals. Recipient agrees to abide by these laws and
their regulations -- including the U.S. Department of Commerce Export
Administration Regulations and the U.S. Department of State International
Traffic in Arms Regulations -- and not to transfer, by electronic
transmission or otherwise, any content derived from this email to either a
foreign national or a foreign destination in violation of such laws.
_______________________________________________
grass-user mailing list

grass-user@.osgeo

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_grass-2Duser&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=OBfSgl1s_aokN50AbM4hgIa8k--o2IlLBqyw5RqMUhE&s=6HsZmdgYxBVR5YxnNSQ8MO0SPOsr9DW0JqK9sKi6NcQ&e=

the exe files are compiled C/C++ modules.

the bat-files are starting wrapper files for python scripts living in
..\scripts.

These wrapper files are needed as winGRASS standalone/Osgeo4w uses its own
python stack and doesn't use the system wide python.

The scripts in .. \scripts are all python scripts in Grass7, this has
changed from grass6 to grass7. Therefore the starting scripts wrapper
bat-files in .. \bin which point to the scripts in .. \scripts by using the
right python interpreter (have a look into the bat-files).

-----
best regards
Helmut
--
View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__osgeo-2Dorg.1560.x6.nabble.com_why-2Dis-2Dv-2Dbuild-2Dall-2Dand-2Dmany-2Dothers-2Da-2Dwindows-2Dbatch-2Dfile-2Dand-2Dnot-2Dan-2Dexecutable-2Dtp5263621p5263629.html&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=OBfSgl1s_aokN50AbM4hgIa8k--o2IlLBqyw5RqMUhE&s=fnBmjhWXFdNCDrx6XE__RPs75E2dfHgCt9zjMAxggfE&e=
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_grass-2Duser&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=OBfSgl1s_aokN50AbM4hgIa8k--o2IlLBqyw5RqMUhE&s=6HsZmdgYxBVR5YxnNSQ8MO0SPOsr9DW0JqK9sKi6NcQ&e=

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

They modules should all be compiled executables so legacy shell >scripts

users have can run them ...

AFAIK there were always a distinction in GRASS between compiled code and
scripts since the beginning.

the motivation of the switch to python scripts from grass6 to grass7 was
cross platform compatiliby.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/why-is-v-build-all-and-many-others-a-windows-batch-file-and-not-an-executable-tp5263621p5263636.html
Sent from the Grass - Users mailing list archive at Nabble.com.

I attached a couple txt files (I hope they don't get striped off...) listing the GRASS modules in the "bin" directory - one lists all of the ".exe" modules and one lists all of the ".bat" modules. Why are there both formats? How are we supposed to run (shell) scripts calling the modules? It just doesn't make sense having the two different formats in the same folder... all of the modules should be executables or all of the modules should be Windows Batch files. Having the mix makes it very hard to program.
Thanks
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.
bartolomei.chris@ensco.com
________________________________________
From: grass-user [grass-user-bounces@lists.osgeo.org] On Behalf Of Helmut Kudrnovsky [hellik@web.de]
Sent: Saturday, April 30, 2016 2:00 AM
To: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?

They modules should all be compiled executables so legacy shell >scripts

users have can run them ...

AFAIK there were always a distinction in GRASS between compiled code and
scripts since the beginning.

the motivation of the switch to python scripts from grass6 to grass7 was
cross platform compatiliby.

-----
best regards
Helmut
--
View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__osgeo-2Dorg.1560.x6.nabble.com_why-2Dis-2Dv-2Dbuild-2Dall-2Dand-2Dmany-2Dothers-2Da-2Dwindows-2Dbatch-2Dfile-2Dand-2Dnot-2Dan-2Dexecutable-2Dtp5263621p5263636.html&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=uQVeHu6Q15ho6lpQQVBanCQCyjnZc1zDeveq8TMmFvU&s=_A6U7qWXX5hcJYr_71ts6mPdFGHiyxoxAWsACslM_Ls&e=
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_grass-2Duser&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=uQVeHu6Q15ho6lpQQVBanCQCyjnZc1zDeveq8TMmFvU&s=spb_MjGAd1Q4m7Df3viCfqio5jS5COI6444qT25qsVw&e=

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

(attachments)

bin_bat_files.txt (2.02 KB)
bin_exe_files.txt (5.38 KB)

Bartolomei.Chris-2 wrote

I attached a couple txt files (I hope they don't get striped off...)
listing the GRASS modules in the "bin" directory - one lists all of the
".exe" modules and one lists all of the ".bat" modules. Why are there both
formats? How are we supposed to run (shell) scripts calling the modules?
It just doesn't make sense having the two different formats in the same
folder... all of the modules should be executables or all of the modules
should be Windows Batch files. Having the mix makes it very hard to
program.
Thanks
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.

bartolomei.chris@

________________________________________
From: grass-user [

grass-user-bounces@.osgeo

] On Behalf Of Helmut Kudrnovsky [

hellik@

]
Sent: Saturday, April 30, 2016 2:00 AM
To:

grass-user@.osgeo

Subject: Re: [GRASS-user] why is v.build.all (and many others) a windows
batch file and not an executable?

They modules should all be compiled executables so legacy shell >scripts

users have can run them ...

AFAIK there were always a distinction in GRASS between compiled code and
scripts since the beginning.

the motivation of the switch to python scripts from grass6 to grass7 was
cross platform compatiliby.

-----
best regards
Helmut
--
View this message in context:
https://urldefense.proofpoint.com/v2/url?u=http-3A__osgeo-2Dorg.1560.x6.nabble.com_why-2Dis-2Dv-2Dbuild-2Dall-2Dand-2Dmany-2Dothers-2Da-2Dwindows-2Dbatch-2Dfile-2Dand-2Dnot-2Dan-2Dexecutable-2Dtp5263621p5263636.html&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=uQVeHu6Q15ho6lpQQVBanCQCyjnZc1zDeveq8TMmFvU&s=_A6U7qWXX5hcJYr_71ts6mPdFGHiyxoxAWsACslM_Ls&e=
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list

grass-user@.osgeo

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_grass-2Duser&d=CwIGaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=uQVeHu6Q15ho6lpQQVBanCQCyjnZc1zDeveq8TMmFvU&s=spb_MjGAd1Q4m7Df3viCfqio5jS5COI6444qT25qsVw&e=

The information contained in this email message is intended only for the
use of the individual(s) to whom it is addressed and may contain
information that is privileged and sensitive. If you are not the intended
recipient, or otherwise have received this communication in error, please
notify the sender immediately by email at the above referenced address and
note that any further dissemination, distribution or copying of this
communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of
technology originating in the United States. This includes the electronic
transmission of information and software to foreign countries and to
certain foreign nationals. Recipient agrees to abide by these laws and
their regulations -- including the U.S. Department of Commerce Export
Administration Regulations and the U.S. Department of State International
Traffic in Arms Regulations -- and not to transfer, by electronic
transmission or otherwise, any content derived from this email to either a
foreign national or a foreign destination in violation of such laws.

_______________________________________________
grass-user mailing list

grass-user@.osgeo

http://lists.osgeo.org/mailman/listinfo/grass-user

bin_bat_files.txt (2K)
<http://osgeo-org.1560.x6.nabble.com/attachment/5264356/0/bin_bat_files.txt>
bin_exe_files.txt (7K)
<http://osgeo-org.1560.x6.nabble.com/attachment/5264356/1/bin_exe_files.txt>

Please have a look at

https://lists.osgeo.org/pipermail/grass-dev/2016-May/080044.html

windows batch files are executables in sense of MS windows operating
systems.

thus there are all executables in \bin.

it's a limitation of msys that Windows batch files aren't recognized as
executables.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/why-is-v-build-all-and-many-others-a-windows-batch-file-and-not-an-executable-tp5263621p5264358.html
Sent from the Grass - Users mailing list archive at Nabble.com.

2016-05-03 22:17 GMT+02:00 Bartolomei.Chris <Bartolomei.Chris@ensco.com>:

I attached a couple txt files (I hope they don't get striped off...) listing the GRASS modules in the "bin" directory - one lists all of the ".exe" modules and one lists all of the ".bat" modules. Why are there both formats? How are we supposed to run (shell) scripts calling the modules? It just doesn't make sense having the two different formats in the same folder... all of the modules should be executables or all of the modules should be Windows Batch files. Having the mix makes it very hard to program.

sorry I don't fully understand your question. The `bin` directory
contains executables, in other words programs (modules) which are
added to the PATH when GRASS is starting. The exe files are binary
executables (compiled C modules). The bat files are wrappers around
Python modules (same as it was in GRASS 6 for Bash modules). Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi Martin
The problem I am having is that my bourne shell scripts (#!/bin/sh) cannot execute the bat files ... the scripts call the GRASS modules by name i.e.
v.db.update map=stream_7 layer=3 column=block_col value="-1" --quiet
In GRASS 6.4.4 (with msys) I could just run the scripts and everything ran fine.
I've upgraded to 7.0.4 (from OSGEO4W and with msys) and now my scripts crash any time it tries to execute a GRASS module that is a bat wrapper saying it can't execute them.
The error message is sh: v.db.update: command not found
There is no v.db.update.exe ... only v.db.update.bat ... and, of course, v.db.update.py in the scripts directory.
I have to code it as this now:
python $PY_SCRIPTS/v.db.update.py map=stream_7 layer=3 column=block_col value="-1" --quiet
(where PY_SCRIPTS is the path to the scripts, not the bat wrappers... i.e. c:/OSGEO4W64/apps/Grass/Grass-7.0.4/scripts)

Note that v.db.update is just one of numerous examples ... I tried to attach the list but it bounced.

I understand that some of this is written in C and some of this is written in python ... is it not possible to compile the python into an executable binary (.exe) and just have .exe's in bin?
That would sure save some grief ...
Thanks

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.
bartolomei.chris@ensco.com
________________________________________
From: Martin Landa [landa.martin@gmail.com]
Sent: Tuesday, May 03, 2016 1:25 PM
To: Bartolomei.Chris
Cc: Helmut Kudrnovsky; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?

2016-05-03 22:17 GMT+02:00 Bartolomei.Chris <Bartolomei.Chris@ensco.com>:

I attached a couple txt files (I hope they don't get striped off...) listing the GRASS modules in the "bin" directory - one lists all of the ".exe" modules and one lists all of the ".bat" modules. Why are there both formats? How are we supposed to run (shell) scripts calling the modules? It just doesn't make sense having the two different formats in the same folder... all of the modules should be executables or all of the modules should be Windows Batch files. Having the mix makes it very hard to program.

sorry I don't fully understand your question. The `bin` directory
contains executables, in other words programs (modules) which are
added to the PATH when GRASS is starting. The exe files are binary
executables (compiled C modules). The bat files are wrappers around
Python modules (same as it was in GRASS 6 for Bash modules). Martin

--
Martin Landa
https://urldefense.proofpoint.com/v2/url?u=http-3A__geo.fsv.cvut.cz_gwiki_Landa&d=CwIFaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=X6JAcPIMDN9cfIcLFFOOPJyDBL02gLKLQMdncu9LMY8&s=fbgnLCjRYYslCA5QlxN48QgfXp3CmLx6zKFdGfX3gUY&e=
https://urldefense.proofpoint.com/v2/url?u=http-3A__gismentors.cz_mentors_landa&d=CwIFaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=X6JAcPIMDN9cfIcLFFOOPJyDBL02gLKLQMdncu9LMY8&s=DKTvoZTDeKe1obdGnw2qFMITEAlkqjlIAW84rKFj2JQ&e=

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

In GRASS 6.4.4 (with msys) I could just run the scripts and everything ran

fine.

in the move of GRASS6.x to GRASS7 scripts are changed from shell scripts [1]
to python scripts [2].

therefore some mechanism is needed to start these python scripts with the
right python interpreter (e.g. own GRASS GIS shipped python intepreter),
i.e. bat wraper files in /bin.

have a look at [3] how it is done in the bat wrapper files:
---------------------------
@"%GRASS_PYTHON%" "SCRIPT_DIR/SCRIPT_NAME.py" %*
---------------------------

I understand that some of this is written in C and some of this is written

in python ... is it not possible to compile the >python into an executable
binary (.exe) and just have .exe's in bin?

it is a limitation of msys that it doesn't recognize windows-bat-files as
executables.

[1]
https://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/scripts
[2]
https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_0/scripts
[3]
https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_0/scripts/windows_launch.bat

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/why-is-v-build-all-and-many-others-a-windows-batch-file-and-not-an-executable-tp5263621p5264429.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On 04/05/16 00:50, Bartolomei.Chris wrote:

Hi Martin
The problem I am having is that my bourne shell scripts (#!/bin/sh) cannot execute the bat files ... the scripts call the GRASS modules by name i.e.
v.db.update map=stream_7 layer=3 column=block_col value="-1" --quiet
In GRASS 6.4.4 (with msys) I could just run the scripts and everything ran fine.
I've upgraded to 7.0.4 (from OSGEO4W and with msys) and now my scripts crash any time it tries to execute a GRASS module that is a bat wrapper saying it can't execute them.
The error message is sh: v.db.update: command not found
There is no v.db.update.exe ... only v.db.update.bat ... and, of course, v.db.update.py in the scripts directory.
I have to code it as this now:
python $PY_SCRIPTS/v.db.update.py map=stream_7 layer=3 column=block_col value="-1" --quiet
(where PY_SCRIPTS is the path to the scripts, not the bat wrappers... i.e. c:/OSGEO4W64/apps/Grass/Grass-7.0.4/scripts)

Note that v.db.update is just one of numerous examples ... I tried to attach the list but it bounced.

I understand that some of this is written in C and some of this is written in python ... is it not possible to compile the python into an executable binary (.exe) and just have .exe's in bin?
That would sure save some grief ...

As Helmut has tried to clarify, the issue is with msys, not with GRASS.

More fundamentally, the decision was made to make GRASS on Windows a Windows experience, not a *nix emulation experience. This is one of the reasons why scripts were translated to Python. Users are, therefore, strongly encouraged to use Python as scripting language and not bash. This allows to run your scripts in the standard cmd console and thus not be hit by the incompatibilities between windows logic and *nix logic.

See [1] for a discussion on that topic. For the general discussion on how to handle Python scripts and the installation of Python on the machine, see [2] (be warned: it is one of the longest threads in the grass-dev mailing list - spanning several months).

I understand that handling legacy scripts is an issue for many. But then again a change in major version number does imply API changes... I don't have a magical solution, here. The technically best solution is probably to translate all your scripts to Python, but I am aware that this is not always an option in the real world out there...

Moritz

[1] https://lists.osgeo.org/pipermail/grass-dev/2014-October/071263.html
[2] https://lists.osgeo.org/pipermail/grass-dev/2013-October/065896.html

On Wed, May 4, 2016 at 12:01 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 04/05/16 00:50, Bartolomei.Chris wrote:

Hi Martin
The problem I am having is that my bourne shell scripts (#!/bin/sh) cannot
execute the bat files ...

...

As Helmut has tried to clarify, the issue is with msys, not with GRASS.

More fundamentally, the decision was made to make GRASS on Windows a Windows
experience, not a *nix emulation experience. This is one of the reasons why
scripts were translated to Python. Users are, therefore, strongly encouraged
to use Python as scripting language and not bash. This allows to run your
scripts in the standard cmd console and thus not be hit by the
incompatibilities between windows logic and *nix logic.

Just FYI: there is also a Wiki page:
https://grasswiki.osgeo.org/wiki/Converting_Bash_scripts_to_Python

(@all: please add more tricks there)

Markus

I want to thank everyone for their feedback and information on this issue, you folks are awesome!
While I think that there could have been a way to move forward with python and yet not break the legacy shell scripts users have when migrating, I understand the changes now.
I do have a work-around that seems to be ok with msys - basically just spelling out the .bat file for those commands that are not executables... this way I only have to rewrite the afflicted module commands. Since I have to update the commands for syntax anyway, then it's not too bad. Better than having to translate into a different language (I am from California afterall ... we only speak "dude" here...lol ...)
Thanks again!
:slight_smile:
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.
bartolomei.chris@ensco.com
________________________________________
From: neteler.osgeo@gmail.com [neteler.osgeo@gmail.com] On Behalf Of Markus Neteler [neteler@osgeo.org]
Sent: Wednesday, May 04, 2016 3:16 AM
To: Moritz Lennert
Cc: Bartolomei.Chris; Martin Landa; grass-user@lists.osgeo.org; Helmut Kudrnovsky
Subject: Re: [GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?

On Wed, May 4, 2016 at 12:01 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 04/05/16 00:50, Bartolomei.Chris wrote:

Hi Martin
The problem I am having is that my bourne shell scripts (#!/bin/sh) cannot
execute the bat files ...

...

As Helmut has tried to clarify, the issue is with msys, not with GRASS.

More fundamentally, the decision was made to make GRASS on Windows a Windows
experience, not a *nix emulation experience. This is one of the reasons why
scripts were translated to Python. Users are, therefore, strongly encouraged
to use Python as scripting language and not bash. This allows to run your
scripts in the standard cmd console and thus not be hit by the
incompatibilities between windows logic and *nix logic.

Just FYI: there is also a Wiki page:
https://urldefense.proofpoint.com/v2/url?u=https-3A__grasswiki.osgeo.org_wiki_Converting-5FBash-5Fscripts-5Fto-5FPython&d=CwIBaQ&c=DsZY2bea7iNIzyp-7sZ0t0F2UfNQZUfZhEPCv_2wBI0&r=O31ltou6ygJL2Y01kQyNJJD2kiILIsbyz2V0Hn4lFUY&m=1joyr5qqmGcPxI_gvQM5j6XPFqwA8NL1fWvpO4gnUV8&s=t5cXo-k0mqdVbY3xpPAB7ojsV4z-0JGrk2-9nTFN6k0&e=

(@all: please add more tricks there)

Markus

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

On Wed, May 4, 2016 at 7:37 PM, Bartolomei.Chris
<Bartolomei.Chris@ensco.com> wrote:

I want to thank everyone for their feedback and information on this issue, you folks are awesome!
While I think that there could have been a way to move forward with python and yet not break the legacy shell scripts users have when migrating, I understand the changes now.

Well, we spent *significant* time on this. Please see the discussion
which spanned over months as mentioned earlier here.
Of course fresh ideas are always welcome.

I do have a work-around that seems to be ok with msys - basically just spelling out the .bat file for those commands that are not executables... this way I only have to rewrite the afflicted module commands. Since I have to update the commands for syntax anyway, then it's not too bad.

Can you please post an example here or add it directly to the Wiki page:
https://grasswiki.osgeo.org/wiki/Converting_Bash_scripts_to_Python

This will help others then, too.

Better than having to translate into a different language (I am from California afterall ... we only speak "dude" here...lol ...)
Thanks again!
:slight_smile:
Chris

cheers
Markus

Bartolomei.Chris wrote:

While I think that there could have been a way to move forward with
python and yet not break the legacy shell scripts users have when
migrating, I understand the changes now.

If MSys treats other shell scripts as executables, one option might be
to auto-generate a shell-script wrapper for each Python script, in the
same way that batch-file wrappers are generated.

The batch-file wrappers are generated by a rule in Script.make:

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

This is run as part of the process of "building" a script; it just
takes a template .bat file and inserts the script name and directory.

It would be a straightfoward matter to add a similar rule to do the
same for a shell script; the only question is whether this should be
done automatically and whether the wrappers should go into the bin
directory or some other directory (it depends upon whether they will
interfere with contexts other than shell scripts).

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