Skip to content

Commit

Permalink
Merge pull request #28 from mundialis/add_check_installed_addons
Browse files Browse the repository at this point in the history
added check_installed_addon()
  • Loading branch information
JHalbauer authored Apr 24, 2024
2 parents 143ede8 + 361056f commit aeda8d8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/grass_gis_helpers/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,17 @@ def test_memory(memory_string):
return free_ram
else:
return memory


def check_installed_addon(addon, url):
"""Check if addon is already installed and raise error if not.
Args:
addon(string): Addon to check if it is installed
url(string): Path to addon
"""
if not grass.find_program(addon, "--help"):
msg = (
f"The '{addon}' module was not found, install it first:\n"
f"g.extension {addon} url={url}"
)
grass.fatal(_(msg))

0 comments on commit aeda8d8

Please sign in to comment.