diff --git a/bin/qgis/smoderp2d-plugin/scripts/build_package.sh b/bin/qgis/smoderp2d-plugin/scripts/build_package.sh index ce47f329..fd3395b6 100755 --- a/bin/qgis/smoderp2d-plugin/scripts/build_package.sh +++ b/bin/qgis/smoderp2d-plugin/scripts/build_package.sh @@ -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 diff --git a/bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py b/bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py index 4cef0a8f..570c04c5 100644 --- a/bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py +++ b/bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py @@ -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 ' 'documentation.' ) self.runner.create_location(QgsProject.instance().crs().authid()) diff --git a/smoderp2d/providers/grass/__init__.py b/smoderp2d/providers/grass/__init__.py index 8b1d015d..7a9e1b01 100644 --- a/smoderp2d/providers/grass/__init__.py +++ b/smoderp2d/providers/grass/__init__.py @@ -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() diff --git a/smoderp2d/providers/grass/data_preparation.py b/smoderp2d/providers/grass/data_preparation.py index f491d29e..15e969c2 100644 --- a/smoderp2d/providers/grass/data_preparation.py +++ b/smoderp2d/providers/grass/data_preparation.py @@ -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):