From 5fed22e9963e6cad40fe03fbaf152d4a4b72fad1 Mon Sep 17 00:00:00 2001 From: wvangerwen <41104904+wvangerwen@users.noreply.github.com> Date: Fri, 3 May 2024 13:13:30 +0200 Subject: [PATCH] Small fixes (#169) * add pyogrio dependency * deploy legger --- hhnk_threedi_plugin/env/environment.yml | 1 + hhnk_threedi_plugin/env/environment_dev.yml | 1 + .../env/environment_services.yml | 3 +- scripts/run_deploy_plugin_across_users.py | 60 +++++++++++++++---- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/hhnk_threedi_plugin/env/environment.yml b/hhnk_threedi_plugin/env/environment.yml index d0c5394..0ad0890 100644 --- a/hhnk_threedi_plugin/env/environment.yml +++ b/hhnk_threedi_plugin/env/environment.yml @@ -27,6 +27,7 @@ dependencies: - openpyxl=3.0.9 - cached_property=1.5.2 - rtree=1.0.1 + - pyogrio - pip: # 3Di packages are not conda installable and are therefore installed by PIP - threedi_modelchecker==2.4.0 #ThreediToolbox 2.5.5 diff --git a/hhnk_threedi_plugin/env/environment_dev.yml b/hhnk_threedi_plugin/env/environment_dev.yml index 0f9d25f..cc855f5 100644 --- a/hhnk_threedi_plugin/env/environment_dev.yml +++ b/hhnk_threedi_plugin/env/environment_dev.yml @@ -27,6 +27,7 @@ dependencies: - openpyxl=3.0.9 - cached_property=1.5.2 - rtree=1.0.1 + - pyogrio - pip: # 3Di packages are not conda installable and are therefore installed by PIP - threedi_modelchecker==2.4.0 #ThreediToolbox 2.5.5 diff --git a/hhnk_threedi_plugin/env/environment_services.yml b/hhnk_threedi_plugin/env/environment_services.yml index 552602a..f9587c2 100644 --- a/hhnk_threedi_plugin/env/environment_services.yml +++ b/hhnk_threedi_plugin/env/environment_services.yml @@ -1,4 +1,4 @@ -# """This is an environment for conda environment on ota155 and ota514 +# """This is an environment for conda environment on ota155 and srv514 # Can be used as standalone env where the following utils should work: # - hhnk-threedi-tools # - hhnk-research-tools @@ -37,6 +37,7 @@ dependencies: - openpyxl=3.1.2 - cached_property=1.5.2 - rtree=1.0.1 + - pyogrio #Voor DataCheker - flask # oude datachecker diff --git a/scripts/run_deploy_plugin_across_users.py b/scripts/run_deploy_plugin_across_users.py index bf0d7ec..347850f 100644 --- a/scripts/run_deploy_plugin_across_users.py +++ b/scripts/run_deploy_plugin_across_users.py @@ -7,27 +7,61 @@ PLUGINS_DIR = r"c://Users//{user}//AppData//Roaming//3Di//QGIS3//profiles//default//python//plugins" # noqa plugins_dir = PLUGINS_DIR # from pathlib import Path -users = get_users() - -selected_users = [] -for user in users: - try: - print(f"checking user '{user}'") - user_plugins_dir = Path(plugins_dir.format(user=user)) - if user_plugins_dir.parent.is_dir(): - if len([i for i in user_plugins_dir.glob("*hhnk_threedi_plugin")]) == 1: - selected_users.append(user) - except: - pass + + +def select_users(plugin_name="hhnk_threedi_plugin"): + """Get users that have a plugin installed.""" + users = get_users() + selected_users = [] + + for user in users: + try: + print(f"checking user '{user}'") + user_plugins_dir = Path(plugins_dir.format(user=user)) + if user_plugins_dir.parent.is_dir(): + if len([i for i in user_plugins_dir.glob(f"*{plugin_name}")]) == 1: + selected_users.append(user) + except: + pass + return selected_users + + +# %% HHNK-THREEDI-PLUGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +selected_users = select_users("hhnk_threedi_plugin") print("\nSelected users:") print(selected_users) + + # %% deploy( admin_user="wvangerwen", - plugins=["hhnk_threedi_plugin", "ThreeDiToolbox"], + plugins=[ + "hhnk_threedi_plugin", + "ThreeDiToolbox", + "threedi_models_and_simulations", + "threedi_schematisation_editor", + ], users=selected_users, users_ignored=[], files_ignored=["local_settings.py", "api_key.txt"], ) + + +# %% LEGGERTOOL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +selected_users = select_users("legger") +print(selected_users) + # %% + +deploy( + admin_user="wvangerwen", + plugins=[ + "legger", + ], + users=selected_users, + users_ignored=[], + files_ignored=["local_settings.py", "api_key.txt"], +)