From dfee2e90d66a8419d5f66d2fc3bc75409333082c Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Thu, 3 Oct 2024 16:01:28 +0200
Subject: [PATCH] Trying to fix infinite recursion error.

---
 libworkflows/__init__.py     |  2 +-
 libworkflows/libworkflows.py | 16 ++++++----------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/libworkflows/__init__.py b/libworkflows/__init__.py
index 3d121f2..2161ccf 100644
--- a/libworkflows/__init__.py
+++ b/libworkflows/__init__.py
@@ -1,6 +1,6 @@
 __copyright__ = "Copyright (C) 2020 Blaise Li"
 __licence__ = "GNU GPLv3"
-__version__ = 0.6
+__version__ = 0.6.1
 from .libworkflows import (
     SHELL_FUNCTIONS, cleanup_and_backup, column_converter,
     ensure_relative, envmods,
diff --git a/libworkflows/libworkflows.py b/libworkflows/libworkflows.py
index 70f0388..114cf64 100644
--- a/libworkflows/libworkflows.py
+++ b/libworkflows/libworkflows.py
@@ -221,26 +221,22 @@ def run_with_modules(
 
 def envmods(
         mod_name,
-        module_versions,
-        dependency=None):
+        module_versions):
     """
     Generate a list of string representing the modules to be loaded.
 
     *mod_name* will be used as a key in the *module_versions*
     dictionary in order to get the associated version number.
 
-    If *dependency* is set, it is assumed that the dictionary
-    entry for *mod_name* is actually a sub-dictionary of dependencies
-    for module *mod_name* (including *mod_name* itself) where
-    *dependency* will be found as a key.
+    If the dictionary entry for *mod_name* is actually a sub-dictionary
+    of dependencies for module *mod_name* (including *mod_name* itself),
+    the list of modules will be those in this sub-dictionary.
     """
     if isinstance(module_versions[mod_name], Mapping):
         return list(chain.from_iterable(
-            envmods(mod_name, module_versions, dependency=dependency)
+            envmods(dependency, module_versions[mod_name])
             for dependency in module_versions[mod_name]))
-    if dependency is None:
-        return [f"{mod_name}/{module_versions[mod_name]}"]
-    return [f"{dependency}/{module_versions[mod_name][dependency]}"]
+    return [f"{mod_name}/{module_versions[mod_name]}"]
 
 
 def run_and_write_methods(
-- 
GitLab