[GRASS-git] [OSGeo/grass] 9da94b: init: Add --tmp-mapset option (#313)

Vaclav Petras noreply at github.com
Tue Feb 4 11:43:00 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/OSGeo/grass
  Commit: 9da94b70eab8313f2a1e70752609f7b2caa2e741
      https://github.com/OSGeo/grass/commit/9da94b70eab8313f2a1e70752609f7b2caa2e741
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2020-02-04 (Tue, 04 Feb 2020)

  Changed paths:
    M lib/init/grass.py
    M lib/init/grass7.html
    A lib/init/testsuite/test_grass_tmp_mapset.py

  Log Message:
  -----------
  init: Add --tmp-mapset option (#313)

This adds --tmp-mapset to the main executable which creates a temporary mapset
in the location specified in the command line. Intended to be used with --exec
and documented that way, but not explicitly checked, so --tmp-mapset without
--exec is possible for experimental purposes (same as --tmp-location).

It handles error states related to common mistakes (and gives suggestions
to user what might be wrong if that info is available).
It also handles errors caused by interaction with -c and --tmp-location.

Documentation (HTML and --help) follows what was already done for --tmp-location
and modifies doc for --tmp-location to make the differences clear, although
providing a set of specific use cases for each might help further.

Test (a first automated test in lib/init) does not fully conform to the current
GRASS GIS standard. It is using the plain Python unittest and not the GRASS GIS extension
of it (grass.gunittest). For this test, the differences in code are minimal,
but the test does not need functions from grass.gunittest nor its setup of
temporary mapset (meant for modules). As a result of using plain unittest,
this test runs outside of the GRASS GIS session. However, it still needs
to know about the tested executable which, if not already available, needs to be put
on PATH as grass (given what is hardcoded in the test now).

A smaller rewrite of some of the code for checking and setting up mapset
was necessary in order to accommodate the new code, specifically the
initial splitting of provided path and diagnostic of invalid location path.
However, adding notes to the code to facilitate further rewrite which is due.




More information about the grass-commit mailing list