123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <h2>DESCRIPTION</h2>
- <!-- TODO: the use of Addon and extension is not coherent -->
- <em>g.extension</em> downloads and installs, removes or updates
- extensions (addons) from the official
- <a href="https://grass.osgeo.org/grass7/manuals/addons/">GRASS GIS Addons repository</a>
- or from user-specified source code repositories into the local GRASS GIS
- installation.
- <p>
- Two types of extensions are supported:
- <ul>
- <li>Python scripts: they are installed without the need of compilation or (usually)
- the need of special dependencies.</li>
- <li>Source code (mostly written in C programming language; may also be written
- in C++, Fortran or other languages): while on MS-Windows systems the requested
- GRASS GIS extension is downloaded pre-compiled from the GRASS GIS site, on Unix
- based systems the installation is preceded by the automated download of the
- extension's source code along with subsequent compilation and installation.
- This requires a compiler environment to be present on the user's computer.</li>
- </ul>
- <h3>Managing installed extensions</h3>
- <p>Re-running <em>g.extension</em> on an installed GRASS GIS Addon
- extension re-installs the requested extension which may include
- updates.
- <p>
- To bulk-update all locally installed GRASS GIS extensions,
- <em><a href="g.extension.all.html">g.extension.all</a></em> module
- is available.
- <h3>Where the extensions are installed</h3>
- GRASS GIS extensions are installed by <em>g.extension</em> into a dedicated
- directory.
- The default is a directory for application data and settings inside
- the user's home directory.
- On GNU/Linux it is <tt>$HOME/.grass7/addons</tt>,
- on MS-Windows it is <tt>$APPDATA\GRASS7\addons</tt>.
- The name of the directory is stored in the <tt>GRASS_ADDON_BASE</tt>
- environmental variable.
- <p>
- The flag <b>-s</b> changes this install target directory to the GRASS GIS
- installation directory
- (determined by <tt>GISBASE</tt> environmental variable, e.g. <tt>/usr/</tt>)
- rather than the default directory defined as per <tt>GRASS_ADDON_BASE</tt>
- (see also documentation for <a href="variables.html">variables</a>).
- <em>g.extension</em> checks if the user has permission to write to
- <tt>GISBASE</tt> or <tt>GRASS_ADDON_BASE</tt>.
- <p>
- The place where the extensions are installed can be customized by
- the option <b>prefix</b>. Ensuring that these extensions will be accessible
- in GRASS GIS is in this case in the responsibility of the user.
- <h3>Source code sources and repositories</h3>
- <h4>GRASS GIS Addons SVN repository</h4>
- By default, <em>g.extension</em> installs extensions from the official
- GRASS GIS Addons SVN repository. However, different sources can be specified
- using the <b>url</b> option.
- <p>
- Individual extensions can also be installed by providing a URL to the
- source code on OSGeo Trac. This, however, works only for certain directories
- where the download of ZIP files was enabled by project administrators of
- the trac server.
- <h4>Local source code directory</h4>
- Optionally, new extension can be also installed from a source code placed
- in a local directory on disk. This is advantageous when developing
- a new module.
- To keep the directory clean, the directory content is copied
- to a temporary directory and the compilation happens there.
- <h4>Local source code ZIP file</h4>
- In addition, new extension can be also installed from a ZIP file
- or an archive file from the TAR family (e.g., <tt>.tar.gz</tt> or <tt>.bz2</tt>).
- The file can be on disk (specified with a path), or on web (specified by
- an URL).
- <h4>Online repositories: GitHub, GitLab and Bitbucket</h4>
- For well known general hosting services, namely GitHub, GitLab and Bitbucket,
- <em>g.extension</em> supports the download of a repository as a ZIP file.
- Here the user only needs to provide a base URL to the repository web page
- (with or without the <tt>https://</tt> part).
- For GitLab and Bitbucket, the latest source code in the default branch is
- downloaded, for GitHub, the latest source code in the master branch is downloaded.
- Of course, a user can still specify the full URL of a ZIP file
- and install a specific branch or release in this way (ZIP file mechanism
- will be applied).
- <p>
- For the official repository, <em>g.extension</em> supports listing available
- extensions (addons) and few other metadata-related operations which
- depend on a specific infrastructure.
- For other sources and repositories, this is not supported because it is
- assumed that other sources contain only one extension, typically a module
- or group of modules.
- <h4>Needed directory layout</h4>
- When none of the above sources is identified, <em>g.extension</em> assumes
- that the source is a Subversion repository and uses the <em>svn</em> command
- line tool to obtain the source code. The expected structure of the repository
- should be the same as the one of the official repository.
- <p>
- Non-official sources are supported on all operating systems except for
- MS-Windows.
- <h3>Compilation and installation</h3>
- On MS-Windows systems, where compilation tools are typically not readily
- locally installed, <em>g.extension</em> downloads a precompiled executable
- from the GRASS GIS project server. On all other operating systems
- where it is not difficult to install compilation tools,
- <em>g.extension</em> downloads the source code of the requested
- extension (addon) and compiles it locally.
- This applies for both C and Python modules
- as well as any other extensions. The reason is that more things such
- as manual page are compiled, not only the source code (which is really
- necessary to compile just in case of C).
- <h2>EXAMPLES</h2>
- <h3>Download and install of an extension</h3>
- Download and install <em>r.stream.distance</em> into current GRASS installation
- <div class="code"><pre>
- g.extension extension=r.stream.distance
- </pre></div>
- This installs the extension from the official repository.
- For convenience, a shorter syntax can be used:
- <div class="code"><pre>
- g.extension r.stream.distance
- </pre></div>
- <h3>Download and install of an extension when behind a proxy</h3>
- Example for an open http proxy:
- <div class="code"><pre>
- # syntax: http://proxyurl:proxyport
- g.extension extension=r.stream.distance proxy="http://proxy.example.com:8080"
- </pre></div>
- <p>
- Example for a proxy with proxy authentication:
- <div class="code"><pre>
- # syntax: http://username:password@proxyurl:proxyport
- g.extension extension=r.stream.distance proxy="http://username:password@proxy.example.com:8080"
- </pre></div>
- <h3>Managing the extensions</h3>
- List all available extensions in the official GRASS GIS Addons repository:
- <div class="code"><pre>
- g.extension -l
- </pre></div>
- List all locally installed extensions:
- <div class="code"><pre>
- g.extension -a
- </pre></div>
- Removal of a locally installed extension:
- <div class="code"><pre>
- g.extension extension=r.stream.distance operation=remove
- </pre></div>
- <h3>Installing from various online repositories: GitHub, GitLab, Bitbucket</h3>
- Simple URL to GitHub, GitLab, Bitbucket repositories:
- <div class="code"><pre>
- g.extension r.example url=github.com/johnsmith/r.example
- </pre></div>
- Simple URL to OSGeo Trac (downloads a ZIP file, requires download to be enabled in Trac):
- <div class="code"><pre>
- g.extension r.example url=trac.osgeo.org/.../r.example
- </pre></div>
- In general, when a ZIP file or other archive is provided, the full URL can be used:
- <div class="code"><pre>
- g.extension r.example url=http://example.com/.../r.example?format=zip
- </pre></div>
- Note that because of MS-Windows operating system architecture,
- only official repository is supported on this platform.
- <h3>Install a specific version from Addons</h3>
- To install a specific version from GRASS GIS Addons, specify the full
- URL pointing to Trac code browser and include Subversion revision
- number. For example, this installs the version number 57854 of
- r.local.relief module:
- <div class="code"><pre>
- g.extension r.local.relief url="https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.local.relief?rev=57854&format=zip"
- </pre></div>
- <h3>Installing when writing a module locally</h3>
- Having source code of a GRASS module in a directory on disk
- one can install it using:
- <div class="code"><pre>
- g.extension r.example url=/local/directory/r.example/
- </pre></div>
- <h2>KNOWN ISSUES</h2>
- Toolboxes in the official repository cannot be downloaded.
- <p>
- On MS-Windows, only the official repository is working
- because there is no way of compiling the modules
- <!-- what does it mean?? -->
- (a Python replacement for Python scripts should be implemented).
- <h2>TROUBLESHOOTING</h2>
- Since extensions have to be compiled on Unix based systems (Linux, Mac OSX etc.)
- unless a Python extension is installed, a full compiler environment must be
- present on the user's computer.
- <h3>ERROR: Please install GRASS development package</h3>
- While GRASS GIS is available on the user's computer, the respective development
- package is lacking. If GRASS was installed from a (Linux) repository, also the
- grass-dev* package (commonly named "grass-dev" or "grass-devel", sometimes along
- with the version number) must be installed.
- <h2>SEE ALSO</h2>
- <em>
- <a href="g.extension.all.html">g.extension.all</a>
- </em>
- <p>
- <a href="https://grass.osgeo.org/grass7/manuals/addons/">GRASS GIS 7 Addons Manual pages</a>
- <br>
- <a href="http://grasswiki.osgeo.org/wiki/GRASS_AddOns">GRASS Addons</a> wiki page.
- <h2>AUTHORS</h2>
- Markus Neteler (original shell script)<br>
- Martin Landa, Czech Technical University in Prague, Czech Republic (Python rewrite)<br>
- Vaclav Petras, <a href="http://gis.ncsu.edu/osgeorel/">NCSU OSGeoREL</a> (support for general sources, partial refactoring)
- <p>
- <i>Last changed: $Date$</i>
|