Skip to content
Snippets Groups Projects
Commit dfee2e90 authored by Blaise Li's avatar Blaise Li
Browse files

Trying to fix infinite recursion error.

parent e7c9e8fd
Branches
No related tags found
No related merge requests found
__copyright__ = "Copyright (C) 2020 Blaise Li" __copyright__ = "Copyright (C) 2020 Blaise Li"
__licence__ = "GNU GPLv3" __licence__ = "GNU GPLv3"
__version__ = 0.6 __version__ = 0.6.1
from .libworkflows import ( from .libworkflows import (
SHELL_FUNCTIONS, cleanup_and_backup, column_converter, SHELL_FUNCTIONS, cleanup_and_backup, column_converter,
ensure_relative, envmods, ensure_relative, envmods,
......
...@@ -221,26 +221,22 @@ def run_with_modules( ...@@ -221,26 +221,22 @@ def run_with_modules(
def envmods( def envmods(
mod_name, mod_name,
module_versions, module_versions):
dependency=None):
""" """
Generate a list of string representing the modules to be loaded. Generate a list of string representing the modules to be loaded.
*mod_name* will be used as a key in the *module_versions* *mod_name* will be used as a key in the *module_versions*
dictionary in order to get the associated version number. dictionary in order to get the associated version number.
If *dependency* is set, it is assumed that the dictionary If the dictionary entry for *mod_name* is actually a sub-dictionary
entry for *mod_name* is actually a sub-dictionary of dependencies of dependencies for module *mod_name* (including *mod_name* itself),
for module *mod_name* (including *mod_name* itself) where the list of modules will be those in this sub-dictionary.
*dependency* will be found as a key.
""" """
if isinstance(module_versions[mod_name], Mapping): if isinstance(module_versions[mod_name], Mapping):
return list(chain.from_iterable( 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])) for dependency in module_versions[mod_name]))
if dependency is None: return [f"{mod_name}/{module_versions[mod_name]}"]
return [f"{mod_name}/{module_versions[mod_name]}"]
return [f"{dependency}/{module_versions[mod_name][dependency]}"]
def run_and_write_methods( def run_and_write_methods(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment