瀏覽代碼

pythonlib: update script.setup docs (#2000)

Now with correct instructions for mac
Black formatted
nilason 3 年之前
父節點
當前提交
4f4f6bd5d0
共有 1 個文件被更改,包括 10 次插入11 次删除
  1. 10 11
      python/grass/script/setup.py

+ 10 - 11
python/grass/script/setup.py

@@ -24,17 +24,16 @@ Usage::
     # query GRASS itself for its GISBASE
     # (with fixes for specific platforms)
     # needs to be edited by the user
-    grass8bin = 'grass'
-    if sys.platform.startswith('win'):
+    grass8bin = "grass"
+    if sys.platform.startswith("win"):
         # MS Windows
-        grass8bin = r'C:\OSGeo4W\bin\grass.bat'
+        grass8bin = r"C:\OSGeo4W\bin\grass.bat"
         # uncomment when using standalone WinGRASS installer
         # grass8bin = r'C:\Program Files (x86)\GRASS GIS 8.0.0\grass.bat'
         # this can be avoided if GRASS executable is added to PATH
-    elif sys.platform == 'darwin':
+    elif sys.platform == "darwin":
         # Mac OS X
-        # TODO: this have to be checked, maybe unix way is good enough
-        grass8bin = '/Applications/GRASS/GRASS-8.0.app/'
+        grass8bin = "/Applications/GRASS-8.0.app/Contents/Resources/bin/grass"
 
     # query GRASS GIS itself for its Python package path
     grass_cmd = [grass8bin, "--config", "python_path"]
@@ -51,15 +50,15 @@ Usage::
     rcfile = gsetup.init(gisdb, location, mapset)
 
     # example calls
-    gs.message('Current GRASS GIS 8 environment:')
+    gs.message("Current GRASS GIS 8 environment:")
     print(gs.gisenv())
 
-    gs.message('Available raster maps:')
-    for rast in gs.list_strings(type='raster'):
+    gs.message("Available raster maps:")
+    for rast in gs.list_strings(type="raster"):
         print(rast)
 
-    gs.message('Available vector maps:')
-    for vect in gs.list_strings(type='vector'):
+    gs.message("Available vector maps:")
+    for vect in gs.list_strings(type="vector"):
         print(vect)
 
     # clean up at the end