g.extension.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <h2>DESCRIPTION</h2>
  2. <!-- TODO: the use of Addon and extension is not coherent -->
  3. <em>g.extension</em> downloads and installs, removes or updates
  4. extensions (addons) from the official
  5. <a href="https://grass.osgeo.org/grass7/manuals/addons/">GRASS GIS Addons repository</a>
  6. or from user-specified source code repositories into the local GRASS GIS
  7. installation.
  8. <p>
  9. Two types of extensions are supported:
  10. <ul>
  11. <li>Python scripts: they are installed without the need of compilation or (usually)
  12. the need of special dependencies.</li>
  13. <li>Source code (mostly written in C programming language; may also be written
  14. in C++, Fortran or other languages): while on MS-Windows systems the requested
  15. GRASS GIS extension is downloaded pre-compiled from the GRASS GIS site, on Unix
  16. based systems the installation is preceded by the automated download of the
  17. extension's source code along with subsequent compilation and installation.
  18. This requires a compiler environment to be present on the user's computer.</li>
  19. </ul>
  20. <h3>Managing installed extensions</h3>
  21. <p>Re-running <em>g.extension</em> on an installed GRASS GIS Addon
  22. extension re-installs the requested extension which may include
  23. updates.
  24. <p>
  25. To bulk-update all locally installed GRASS GIS extensions,
  26. <em><a href="g.extension.all.html">g.extension.all</a></em> module
  27. is available.
  28. <h3>Where the extensions are installed</h3>
  29. GRASS GIS extensions are installed by <em>g.extension</em> into a dedicated
  30. directory.
  31. The default is a directory for application data and settings inside
  32. the user's home directory.
  33. On GNU/Linux it is <tt>$HOME/.grass7/addons</tt>,
  34. on MS-Windows it is <tt>$APPDATA\GRASS7\addons</tt>.
  35. The name of the directory is stored in the <tt>GRASS_ADDON_BASE</tt>
  36. environmental variable.
  37. <p>
  38. The flag <b>-s</b> changes this install target directory to the GRASS GIS
  39. installation directory
  40. (determined by <tt>GISBASE</tt> environmental variable, e.g. <tt>/usr/</tt>)
  41. rather than the default directory defined as per <tt>GRASS_ADDON_BASE</tt>
  42. (see also documentation for <a href="variables.html">variables</a>).
  43. <em>g.extension</em> checks if the user has permission to write to
  44. <tt>GISBASE</tt> or <tt>GRASS_ADDON_BASE</tt>.
  45. <p>
  46. The place where the extensions are installed can be customized by
  47. the option <b>prefix</b>. Ensuring that these extensions will be accessible
  48. in GRASS GIS is in this case in the responsibility of the user.
  49. <h3>Source code sources and repositories</h3>
  50. <h4>GRASS GIS Addons SVN repository</h4>
  51. By default, <em>g.extension</em> installs extensions from the official
  52. GRASS GIS Addons SVN repository. However, different sources can be specified
  53. using the <b>url</b> option.
  54. <p>
  55. Individual extensions can also be installed by providing a URL to the
  56. source code on OSGeo Trac. This, however, works only for certain directories
  57. where the download of ZIP files was enabled by project administrators of
  58. the trac server.
  59. <h4>Local source code directory</h4>
  60. Optionally, new extension can be also installed from a source code placed
  61. in a local directory on disk. This is advantageous when developing
  62. a new module.
  63. To keep the directory clean, the directory content is copied
  64. to a temporary directory and the compilation happens there.
  65. <h4>Local source code ZIP file</h4>
  66. In addition, new extension can be also installed from a ZIP file
  67. or an archive file from the TAR family (e.g., <tt>.tar.gz</tt> or <tt>.bz2</tt>).
  68. The file can be on disk (specified with a path), or on web (specified by
  69. an URL).
  70. <h4>Online repositories: GitHub, GitLab and Bitbucket</h4>
  71. For well known general hosting services, namely GitHub, GitLab and Bitbucket,
  72. <em>g.extension</em> supports the download of a repository as a ZIP file.
  73. Here the user only needs to provide a base URL to the repository web page
  74. (with or without the <tt>https://</tt> part).
  75. For GitLab and Bitbucket, the latest source code in the default branch is
  76. downloaded, for GitHub, the latest source code in the master branch is downloaded.
  77. Of course, a user can still specify the full URL of a ZIP file
  78. and install a specific branch or release in this way (ZIP file mechanism
  79. will be applied).
  80. <p>
  81. For the official repository, <em>g.extension</em> supports listing available
  82. extensions (addons) and few other metadata-related operations which
  83. depend on a specific infrastructure.
  84. For other sources and repositories, this is not supported because it is
  85. assumed that other sources contain only one extension, typically a module
  86. or group of modules.
  87. <h4>Needed directory layout</h4>
  88. When none of the above sources is identified, <em>g.extension</em> assumes
  89. that the source is a Subversion repository and uses the <em>svn</em> command
  90. line tool to obtain the source code. The expected structure of the repository
  91. should be the same as the one of the official repository.
  92. <p>
  93. Non-official sources are supported on all operating systems except for
  94. MS-Windows.
  95. <h3>Compilation and installation</h3>
  96. On MS-Windows systems, where compilation tools are typically not readily
  97. locally installed, <em>g.extension</em> downloads a precompiled executable
  98. from the GRASS GIS project server. On all other operating systems
  99. where it is not difficult to install compilation tools,
  100. <em>g.extension</em> downloads the source code of the requested
  101. extension (addon) and compiles it locally.
  102. This applies for both C and Python modules
  103. as well as any other extensions. The reason is that more things such
  104. as manual page are compiled, not only the source code (which is really
  105. necessary to compile just in case of C).
  106. <h2>EXAMPLES</h2>
  107. <h3>Download and install of an extension</h3>
  108. Download and install <em>r.stream.distance</em> into current GRASS installation
  109. <div class="code"><pre>
  110. g.extension extension=r.stream.distance
  111. </pre></div>
  112. This installs the extension from the official repository.
  113. For convenience, a shorter syntax can be used:
  114. <div class="code"><pre>
  115. g.extension r.stream.distance
  116. </pre></div>
  117. <h3>Download and install of an extension when behind a proxy</h3>
  118. Example for an open http proxy:
  119. <div class="code"><pre>
  120. # syntax: http://proxyurl:proxyport
  121. g.extension extension=r.stream.distance proxy="http://proxy.example.com:8080"
  122. </pre></div>
  123. <p>
  124. Example for a proxy with proxy authentication:
  125. <div class="code"><pre>
  126. # syntax: http://username:password@proxyurl:proxyport
  127. g.extension extension=r.stream.distance proxy="http://username:password@proxy.example.com:8080"
  128. </pre></div>
  129. <h3>Managing the extensions</h3>
  130. List all available extensions in the official GRASS GIS Addons repository:
  131. <div class="code"><pre>
  132. g.extension -l
  133. </pre></div>
  134. List all locally installed extensions:
  135. <div class="code"><pre>
  136. g.extension -a
  137. </pre></div>
  138. Removal of a locally installed extension:
  139. <div class="code"><pre>
  140. g.extension extension=r.stream.distance operation=remove
  141. </pre></div>
  142. <h3>Installing from various online repositories: GitHub, GitLab, Bitbucket</h3>
  143. Simple URL to GitHub, GitLab, Bitbucket repositories:
  144. <div class="code"><pre>
  145. g.extension r.example url=github.com/johnsmith/r.example
  146. </pre></div>
  147. Simple URL to OSGeo Trac (downloads a ZIP file, requires download to be enabled in Trac):
  148. <div class="code"><pre>
  149. g.extension r.example url=trac.osgeo.org/.../r.example
  150. </pre></div>
  151. In general, when a ZIP file or other archive is provided, the full URL can be used:
  152. <div class="code"><pre>
  153. g.extension r.example url=http://example.com/.../r.example?format=zip
  154. </pre></div>
  155. Note that because of MS-Windows operating system architecture,
  156. only official repository is supported on this platform.
  157. <h3>Install a specific version from Addons</h3>
  158. To install a specific version from GRASS GIS Addons, specify the full
  159. URL pointing to Trac code browser and include Subversion revision
  160. number. For example, this installs the version number 57854 of
  161. r.local.relief module:
  162. <div class="code"><pre>
  163. g.extension r.local.relief url="https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.local.relief?rev=57854&amp;format=zip"
  164. </pre></div>
  165. <h3>Installing when writing a module locally</h3>
  166. Having source code of a GRASS module in a directory on disk
  167. one can install it using:
  168. <div class="code"><pre>
  169. g.extension r.example url=/local/directory/r.example/
  170. </pre></div>
  171. <h2>KNOWN ISSUES</h2>
  172. Toolboxes in the official repository cannot be downloaded.
  173. <p>
  174. On MS-Windows, only the official repository is working
  175. because there is no way of compiling the modules
  176. <!-- what does it mean?? -->
  177. (a Python replacement for Python scripts should be implemented).
  178. <h2>TROUBLESHOOTING</h2>
  179. Since extensions have to be compiled on Unix based systems (Linux, Mac OSX etc.)
  180. unless a Python extension is installed, a full compiler environment must be
  181. present on the user's computer.
  182. <h3>ERROR: Please install GRASS development package</h3>
  183. While GRASS GIS is available on the user's computer, the respective development
  184. package is lacking. If GRASS was installed from a (Linux) repository, also the
  185. grass-dev* package (commonly named "grass-dev" or "grass-devel", sometimes along
  186. with the version number) must be installed.
  187. <h2>SEE ALSO</h2>
  188. <em>
  189. <a href="g.extension.all.html">g.extension.all</a>
  190. </em>
  191. <p>
  192. <a href="https://grass.osgeo.org/grass7/manuals/addons/">GRASS GIS 7 Addons Manual pages</a>
  193. <br>
  194. <a href="http://grasswiki.osgeo.org/wiki/GRASS_AddOns">GRASS Addons</a> wiki page.
  195. <h2>AUTHORS</h2>
  196. Markus Neteler (original shell script)<br>
  197. Martin Landa, Czech Technical University in Prague, Czech Republic (Python rewrite)<br>
  198. Vaclav Petras, <a href="http://gis.ncsu.edu/osgeorel/">NCSU OSGeoREL</a> (support for general sources, partial refactoring)
  199. <p>
  200. <i>Last changed: $Date$</i>