Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS plugin: Update GRASS version check for new QGIS version #416

Merged
merged 4 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/qgis/smoderp2d-plugin/scripts/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ source $VENV/bin/activate

script_dir=$(realpath $(dirname $0))
echo $script_dir
### install released SMODERP2D version
pip3 install smoderp2d
### or from git
# (cd ../../.. ;pip3 install .)

pv=$(python3 -V | cut -d' ' -f 2 | cut -d'.' -f 1,2)
LIB=$VENV/lib/python$pv/site-packages
Expand Down
3 changes: 2 additions & 1 deletion bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def run(self):
for line in islice(fin, 1, 2):
if 'SMODERP2D patch applied' not in line:
raise ImportError(
'Your GRASS GIS installation needs to be fixed. Check the '
'There is a bug affecting the plugin functionality. Update QGIS to '
'version 3.34.10/3.38.2 or higher, or apply the fix manually. Check the '
'<a href="https://storm-fsv-cvut.github.io/smoderp2d-manual/providers.html#known-issue">documentation</a>.'
)
self.runner.create_location(QgsProject.instance().crs().authid())
Expand Down
2 changes: 2 additions & 0 deletions smoderp2d/providers/grass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def __init__(self, log_handler=GrassGisLogHandler):
os.environ['GRASS_OVERWRITE'] = '1'
# be quiet
os.environ['GRASS_VERBOSE'] = '0'
# allow to run r.hydrodem also when compatibility test fails
os.environ['GRASS_COMPATIBILITY_TEST'] = '0'

# define storage writer
self.storage = GrassGisWriter()
Expand Down
10 changes: 10 additions & 0 deletions smoderp2d/providers/grass/data_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ def __init__(self, options, writer):
super(PrepareData, self).__init__(writer)

# install r.hydrodem if not available
install_ext = False
ext = Module('g.extension', flags='a', stdout_=PIPE)
list_ext = ext.outputs.stdout.splitlines()
if 'r.hydrodem' not in list_ext:
install_ext = True
else:
# try to run the module
try:
Module("r.hydrodem", run_=False)
except Exception:
install_ext = True
if install_ext:
Logger.info("Installing r.hydrodem extension...")
Module('g.extension', extension='r.hydrodem')

def __del__(self):
Expand Down
Loading