diff --git a/libworkflows/__init__.py b/libworkflows/__init__.py index 3d121f27f7866d9c1629827c3a37cf53c385ea23..2161ccfe66ef18593380c8dd00c920ca25e799cb 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 70f03881d657489f07de8c63d7a3838cae8cf596..114cf64883e2e9ae79168ce09d7291d87281193b 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(