From 1ed6e356430304041dc5202a0c7d4e65eb331e21 Mon Sep 17 00:00:00 2001 From: jhalbauer Date: Wed, 24 Apr 2024 11:42:21 +0200 Subject: [PATCH 1/4] added check_installed_addon() --- src/grass_gis_helpers/general.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/grass_gis_helpers/general.py b/src/grass_gis_helpers/general.py index 6070db7..bf4a6cc 100644 --- a/src/grass_gis_helpers/general.py +++ b/src/grass_gis_helpers/general.py @@ -133,3 +133,16 @@ def test_memory(memory_string): return free_ram else: return memory + + +def check_installed_addon(addon): + """Checks if addon is already installed and raises error if not. + Args: + addon(string): addon to check if it is installed + """ + if not grass.find_program(addon, "--help"): + msg = ( + f"The '{addon}' module was not found, install it first:\n" + f"g.extension {addon}" + ) + grass.fatal(_(msg)) From 5f9bf4578a775eb618216010c1ec3df4f5e38d64 Mon Sep 17 00:00:00 2001 From: jhalbauer Date: Wed, 24 Apr 2024 11:56:18 +0200 Subject: [PATCH 2/4] added changes by JH, AW --- src/grass_gis_helpers/general.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/grass_gis_helpers/general.py b/src/grass_gis_helpers/general.py index bf4a6cc..a29798b 100644 --- a/src/grass_gis_helpers/general.py +++ b/src/grass_gis_helpers/general.py @@ -135,14 +135,15 @@ def test_memory(memory_string): return memory -def check_installed_addon(addon): - """Checks if addon is already installed and raises error if not. +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 + 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}" + f"g.extension {addon} url={url}" ) grass.fatal(_(msg)) From 2dea76a31a29598a1a0a4b1a728bbb1a6b701e00 Mon Sep 17 00:00:00 2001 From: Anika Weinmann <37300249+anikaweinmann@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:03:22 +0200 Subject: [PATCH 3/4] Try to fix linting.yml --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 39eb1ac..d35f8ef 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -4,4 +4,4 @@ on: [push] jobs: lint: - uses: mundialis/github-workflows/.github/workflows/linting.yml@main + uses: mundialis/github-workflows/.github/workflows/linting.yml@linting_workflow_fix From 361056fccc78aaa6ef3083f1702b062ddf0246fe Mon Sep 17 00:00:00 2001 From: Anika Weinmann <37300249+anikaweinmann@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:06:24 +0200 Subject: [PATCH 4/4] Update linting.yml --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index d35f8ef..39eb1ac 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -4,4 +4,4 @@ on: [push] jobs: lint: - uses: mundialis/github-workflows/.github/workflows/linting.yml@linting_workflow_fix + uses: mundialis/github-workflows/.github/workflows/linting.yml@main