grass.app package

Submodules

grass.app.data module

Provides functions for the main GRASS GIS executable

  1. 2020 by Vaclav Petras and the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

This is not a stable part of the API. Use at your own risk.

exception grass.app.data.MapsetLockingException[source]

Bases: Exception

grass.app.data.create_database_directory()[source]

Creates the standard GRASS GIS directory. Creates database directory named grassdata in the standard location according to the platform.

Returns the new path as a string or None if nothing was found or created.

grass.app.data.create_startup_location_in_grassdb(grassdatabase, startup_location_name) → bool[source]

Create a new startup location in the given GRASS database.

Returns True if a new startup location successfully created in the given GRASS database. Returns False if there is no location to copy in the installation or copying failed.

grass.app.data.ensure_default_data_hierarchy()[source]

Ensure that default gisdbase, location and mapset exist. Creates database directory based on the default path determined according to OS if needed. Creates location if needed.

Returns the db, loc, mapset, mapset_path

grass.app.data.get_possible_database_path()[source]

Looks for directory ‘grassdata’ (case-insensitive) in standard locations to detect existing GRASS Database.

Returns the path as a string or None if nothing was found.

grass.app.data.lock_mapset(mapset_path, force_lock_removal, message_callback)[source]

Acquire a lock for a mapset and return name of new lock file

Raises MapsetLockingException when it is not possible to acquire a lock for the given mapset either because of existing lock or due to insufficient permissions. A corresponding localized message is given in the exception.

A message_callback is a function which will be called to report messages about certain states. Specifically, the function is called when forcibly unlocking the mapset.

Assumes that the runtime is set up (specifically that GISBASE is in the environment).

grass.app.runtime module

Provides functions for the main GRASS GIS executable

  1. 2024 by Vaclav Petras and the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

This is not a stable part of the API. Use at your own risk.

grass.app.runtime.append_left_addon_paths(paths, config_dir, env)[source]

Add addons to path

grass.app.runtime.append_left_main_executable_paths(paths, install_path)[source]

Add executables to PATH

grass.app.runtime.ensure_home()[source]

Set HOME if not set on MS Windows

grass.app.runtime.get_grass_config_dir(major_version, minor_version, env)[source]

Get configuration directory

Determines path of GRASS GIS user configuration directory.

grass.app.runtime.set_browser(install_path)[source]

Set path to HTML browser

grass.app.runtime.set_defaults(config_projshare_path)[source]

Set paths or commands for dependencies and auxiliary utilities

grass.app.runtime.set_display_defaults()[source]

Predefine monitor size for certain architectures

grass.app.runtime.set_dynamic_library_path(variable_name, install_path, env)[source]

Define path to dynamic libraries (LD_LIBRARY_PATH on Linux)

grass.app.runtime.set_executable_paths(install_path, grass_config_dir, env)[source]

Add paths with executables to PATH in _env_

grass.app.runtime.set_isis()[source]

Enable a mixed ISIS-GRASS environment

ISIS is Integrated Software for Imagers and Spectrometers by USGS.

grass.app.runtime.set_man_path(install_path, addon_base, env)[source]

Set path for the GRASS man pages

grass.app.runtime.set_path_to_python_executable(env)[source]

Set GRASS_PYTHON environment variable

grass.app.runtime.set_paths(install_path, grass_config_dir, ld_library_path_variable_name)[source]

Set variables with executable paths, library paths, and other paths

grass.app.runtime.set_python_path_variable(install_path, env)[source]

Set PYTHONPATH to find GRASS Python package in subprocesses