locating GRASS installation directories on different operating systems

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

locating GRASS installation directories on different operating systems

Tyler Smith-2
Hi,

I'm updating my Emacs grass-mode (available on MELPA, and also here:
https://bitbucket.org/tws/grass-mode.el/wiki/Home ).

Part of the configuration requires that users tell me where their grass
binary, script and documentation files are. Since people may be using
different versions, multiple versions, pre-packaged or compiled from
source, I can't hard-code paths for this.

I work on Linux, and I think a reasonably robust way for users to find
the information is:

    which grass (i.e., /usr/bin/grass)

to find the binary.

    locate bin/d.title (i.e., /usr/local/grass-7.0.0svn , after trimming
    off 'bin/d.title')

to find the script directory (actually a file nested two beneath the
script directory, but close enough as a landmark)

and

   locate html/d.title (i.e., /usr/local/grass-7.0.0svn/docs/html ,
   after trimming off 'd.title')

to find the documentation directory. I'm assuming users with multiple
installations will be savvy enough to pick among the options they get
back from these commands.

Questions for this list:

1. Are the html docs *always* installed in the same place relative to
the scripts? If so, I would only need the binary and script locations,
and can derive the doc path from there.
2. Will this work as I expect? I know it works on my own machine, but
I'm not sure if it is truly portable across Linux flavours.
3. Will it also work on Mac, or are there better ways to get this
information?
4. How would I direct Windows users to find the equivalent locations on
their systems?

Thanks for your help.

Tyler

--
plantarum.ca
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

RKrug
Tyler Smith <[hidden email]> writes:

> Hi,
>
> I'm updating my Emacs grass-mode (available on MELPA, and also here:
> https://bitbucket.org/tws/grass-mode.el/wiki/Home ).
>
> Part of the configuration requires that users tell me where their grass
> binary, script and documentation files are. Since people may be using
> different versions, multiple versions, pre-packaged or compiled from
> source, I can't hard-code paths for this.
>
> I work on Linux, and I think a reasonably robust way for users to find
> the information is:
>
Mac OS X and multiple homebrew installations. Comments refer to this scenario.

>     which grass (i.e., /usr/bin/grass)
>
> to find the binary.

That will work. But the name of the binary is not necessarily grass, but
grass64 or grass70.

>
>     locate bin/d.title (i.e., /usr/local/grass-7.0.0svn , after trimming
>     off 'bin/d.title')
>
> to find the script directory (actually a file nested two beneath the
> script directory, but close enough as a landmark)
>
> and
>
>    locate html/d.title (i.e., /usr/local/grass-7.0.0svn/docs/html ,
>    after trimming off 'd.title')
>
> to find the documentation directory. I'm assuming users with multiple
> installations will be savvy enough to pick among the options they get
> back from these commands.
>
> Questions for this list:
>
> 1. Are the html docs *always* installed in the same place relative to
> the scripts? If so, I would only need the binary and script locations,
> and can derive the doc path from there.
No idea - can't comment here.

> 2. Will this work as I expect? I know it works on my own machine, but
> I'm not sure if it is truly portable across Linux flavours.
> 3. Will it also work on Mac, or are there better ways to get this
> information?

I know about three ways (apart from own compiling) to install grass on a
mac:

1) The "official" frameworks by Michael Barton [[http://grassmac.wikidot.com/]]
2) MacPorts
3) Homebrew, using either the homebrew grass recipe or the osgeo4mac repos [[https://github.com/OSGeo/homebrew-osgeo4mac]]

I can only talk about the homebrew installations. these are installed at

/usr/local/Cellar/RECIPENAME

where RECIPENAME is grass-64, grass-70 or (which does not work at the
moment) grass
The tree structure looks in principle as follow where "7.0.2" will be
added when this is released and installed.

,----
| .
| └── 7.0.1
|     ├── AUTHORS
|     ├── CHANGES
|     ├── COPYING
|     ├── INSTALL_RECEIPT.json
|     ├── README
|     ├── TODO
|     ├── bin
|     │   └── grass70
|     ├── grass-7.0.1
|     │   ├── AUTHORS
|     │   ├── CHANGES
|     │   ├── COPYING
|     │   ├── GPL.TXT
|     │   ├── REQUIREMENTS.html
|     │   ├── bin
|     │   ├── config.status
|     │   ├── contributors.csv
|     │   ├── contributors_extra.csv
|     │   ├── demolocation
|     │   ├── docs
|     │   ├── driver
|     │   ├── etc
|     │   ├── fonts
|     │   ├── grass70.sh -> ../bin/grass70
|     │   ├── gui
|     │   ├── include
|     │   ├── lib
|     │   ├── locale
|     │   ├── scripts
|     │   ├── share
|     │   ├── tools
|     │   ├── translation_status.json
|     │   └── translators.csv
|     └── grass-base -> grass-7.0.1
`----

So for homebrew, it would be easy to scan the /usr/local/Cellar* for the
directories.

The same (or similar) should be doable for MacPorts and the frameworks.

So I think the best approach would be here to create a function which
scans for the homebrew, official and MacPorts installations of GRASS and
offers to either populate the variable or to print the customization in
the Messages buffer so that it can be copied in the emacs.el file.


> 4. How would I direct Windows users to find the equivalent locations on
> their systems?

No idea - never used GRASS on windows.

>
> Thanks for your help.

Pleasure,

Rainer

>
> Tyler

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

PGP: 0x0F52F982

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user

signature.asc (463 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

Markus Neteler
In reply to this post by Tyler Smith-2
On Thu, Oct 29, 2015 at 3:28 PM, Tyler Smith <[hidden email]> wrote:
> Hi,
>
> I'm updating my Emacs grass-mode (available on MELPA, and also here:
> https://bitbucket.org/tws/grass-mode.el/wiki/Home ).
>
> Part of the configuration requires that users tell me where their grass
> binary, script and documentation files are. Since people may be using
> different versions, multiple versions, pre-packaged or compiled from
> source, I can't hard-code paths for this.

Right.

...
>  a reasonably robust way for users to find
> the information is:

Please better use this (works "everywhere", also on non-Linux
systems): ask GRASS itself where it is - of course the startup script
needs to be in the PATH:

# Linux
grass70 --config path
/usr/local/grass-7.0.2svn

# Windows
C:\>grass70.bat --config path
C:\OSGeo4W\apps\grass\grass-7.0

and so on.

HTH,
Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

RKrug
Markus Neteler <[hidden email]> writes:

> On Thu, Oct 29, 2015 at 3:28 PM, Tyler Smith <[hidden email]> wrote:
>> Hi,
>>
>> I'm updating my Emacs grass-mode (available on MELPA, and also here:
>> https://bitbucket.org/tws/grass-mode.el/wiki/Home ).
>>
>> Part of the configuration requires that users tell me where their grass
>> binary, script and documentation files are. Since people may be using
>> different versions, multiple versions, pre-packaged or compiled from
>> source, I can't hard-code paths for this.
>
> Right.
>
> ...
>>  a reasonably robust way for users to find
>> the information is:
>
> Please better use this (works "everywhere", also on non-Linux
> systems): ask GRASS itself where it is - of course the startup script
> needs to be in the PATH:
>
You could always ask for the path to the grass startup script.

> # Linux
> grass70 --config path
> /usr/local/grass-7.0.2svn
>
> # Windows
> C:\>grass70.bat --config path
> C:\OSGeo4W\apps\grass\grass-7.0
>
> and so on.

I always forget about the --config options

But how robust is this? I think it is also only supported from 7 onwards
(at least my 6.4.4 installation does not know the argument --config)?

Rainer


>
> HTH,
> Markus
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

PGP: 0x0F52F982

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user

signature.asc (463 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

Markus Neteler
On Fri, Oct 30, 2015 at 12:59 PM, Rainer M Krug <[hidden email]> wrote:
> Markus Neteler <[hidden email]> writes:
...
> I always forget about the --config options
>
> But how robust is this?

Robust to my knowledge. There is not much magic behind :-)

> I think it is also only supported from 7 onwards

Right.

> (at least my 6.4.4 installation does not know the argument --config)?

Unless we add it also there (perhaps some effort since that is still a
bash start script).

For now, you could conditionalize on G7, the start script name should
carry the version number anyway.

Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

Tyler Smith-2
In reply to this post by Markus Neteler
On Fri, Oct 30, 2015, at 06:57 AM, Markus Neteler wrote:

>
> Please better use this (works "everywhere", also on non-Linux
> systems): ask GRASS itself where it is - of course the startup script
> needs to be in the PATH:
>
> # Linux
> grass70 --config path
> /usr/local/grass-7.0.2svn
>
> # Windows
> C:\>grass70.bat --config path
> C:\OSGeo4W\apps\grass\grass-7.0

Marvelous, thanks! To confirm, given the path returned by grass70
--config, can I count on the helper programs being under <path>/bin and
<path>/scripts, and the html docs will be under <path>/docs/html? That's
much easier than looking for all three locations.

What about the grass binary itself? Is there a way for GRASS to tell me
that too, or is there a Windows version of `which`?

Best,

Tyler
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: locating GRASS installation directories on different operating systems

Markus Neteler
On Fri, Oct 30, 2015 at 4:09 PM, Tyler Smith <[hidden email]> wrote:
> On Fri, Oct 30, 2015, at 06:57 AM, Markus Neteler wrote:
> Marvelous, thanks! To confirm, given the path returned by grass70
> --config, can I count on the helper programs being under <path>/bin and
> <path>/scripts, and the html docs will be under <path>/docs/html? That's
> much easier than looking for all three locations.

Mostly yes but it may be that some (Linux) distros put the documentation under

/usr/share/man/man1/

> What about the grass binary itself? Is there a way for GRASS to tell me
> that too, or is there a Windows version of `which`?

For Windows, I see some options discussed here (and elsewhere):

http://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line


Best
Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user