[GRASS-SVN] r73096 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 14 18:40:57 PDT 2018


Author: wenzeslaus
Date: 2018-08-14 18:40:56 -0700 (Tue, 14 Aug 2018)
New Revision: 73096

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: -c not needed for --tmp-location (closes #3585)

--tmp-location required -c flag because -c was associated with EPSG specification.
The new approach is that EPSG is a value of whatever flag/option which needs
EPSG or equivalent.

No changes in the code. Parsing just takes any ARG (non-flag) available.
We check if EPSG was provided and that mapset was not provided (i.e. exactly
one ARG was provided). It is no longer possible to use --tmp-location without
ARG to create an XY location.


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2018-08-14 12:44:07 UTC (rev 73095)
+++ grass/trunk/lib/init/grass.py	2018-08-15 01:40:56 UTC (rev 73096)
@@ -292,7 +292,7 @@
           [-e] [-f] [-text | -gtext | -gui] [--config param]
           [[[GISDBASE/]LOCATION_NAME/]MAPSET]
   $CMD_NAME [FLAG]... GISDBASE/LOCATION_NAME/MAPSET --exec EXECUTABLE [EPARAM]...
-  $CMD_NAME -c [geofile | EPSG] --tmp-location --exec EXECUTABLE [EPARAM]...
+  $CMD_NAME --tmp-location [geofile | EPSG] --exec EXECUTABLE [EPARAM]...
 
 {flags}:
   -h or -help or --help or --h   {help_flag}
@@ -1890,11 +1890,15 @@
         params = parse_cmdline(sys.argv[1:], default_gui=default_gui)
     if params.exit_grass and not params.create_new:
         fatal(_("Flag -e requires also flag -c"))
-    if params.tmp_location and not params.create_new:
-        fatal(_("Flag --tmp-location requires also flag -c"))
-    # Theoretically -c is not needed, CRS could be value of --tmp-location
-    # or, considering current code, CRS could be just taken from args.
-    # We allow --tmp-location without --exec (usefulness to be evaluated).
+    if params.tmp_location and not params.geofile:
+        fatal(_("Coordinate reference system argument (e.g. EPSG)"
+                " is needed for --tmp-location"))
+    if params.tmp_location and params.mapset:
+        fatal(_("Only one argument (e.g. EPSG) is needed for"
+                " --tmp-location, mapset name <{}> provided").format(
+                    params.mapset))
+    # For now, we allow, but not advertise/document, --tmp-location
+    # without --exec (usefulness to be evaluated).
 
     grass_gui = params.grass_gui  # put it to variable, it is used a lot
 



More information about the grass-commit mailing list