From 165b18363ca5bf7bac2de7bb6050245e1f8fd46d Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:12:55 -0400 Subject: [PATCH] Fix divvy, remove requirement for old package, ensure looper is using internal module #520 --- looper/cli_pydantic.py | 3 +-- looper/divvy.py | 6 ++++-- requirements/requirements-all.txt | 1 - tests/divvytests/test_divvy_simple.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/looper/cli_pydantic.py b/looper/cli_pydantic.py index 4d815d912..df888fb4e 100644 --- a/looper/cli_pydantic.py +++ b/looper/cli_pydantic.py @@ -26,8 +26,6 @@ from pephubclient import PEPHubClient from pydantic_argparse.argparse.parser import ArgumentParser -from divvy import select_divvy_config - from . import __version__ from .command_models.arguments import ArgumentEnum @@ -354,6 +352,7 @@ def main(test_args=None) -> dict: return run_looper(args, parser, test_args=test_args) + def main_cli() -> None: main() diff --git a/looper/divvy.py b/looper/divvy.py index 49c1fd234..856219ccf 100644 --- a/looper/divvy.py +++ b/looper/divvy.py @@ -401,11 +401,13 @@ def divvy_init(config_path, template_config_path): _LOGGER.error("You must specify a template config file path.") return + if not os.path.isabs(config_path): + config_path = os.path.abspath(config_path) + if config_path and not os.path.exists(config_path): - # dcc.write(config_path) # Init should *also* write the templates. dest_folder = os.path.dirname(config_path) - copytree(os.path.dirname(template_config_path), dest_folder) + copytree(os.path.dirname(template_config_path), dest_folder, dirs_exist_ok=True) template_subfolder = os.path.join(dest_folder, "divvy_templates") _LOGGER.info("Wrote divvy templates to folder: {}".format(template_subfolder)) new_template = os.path.join( diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index 3db01243a..678b318aa 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -1,5 +1,4 @@ colorama>=0.3.9 -divvy>=0.5.0 eido>=0.2.1 jinja2 logmuse>=0.2.0 diff --git a/tests/divvytests/test_divvy_simple.py b/tests/divvytests/test_divvy_simple.py index f7795696a..5770661f7 100644 --- a/tests/divvytests/test_divvy_simple.py +++ b/tests/divvytests/test_divvy_simple.py @@ -4,7 +4,7 @@ from collections import OrderedDict from yacman import YacAttMap -from divvy import select_divvy_config +from looper.divvy import select_divvy_config # For interactive debugging: # import logmuse