def extract_dependencies(plugins, v_type='Release'): """ Extract dependencies from the plugin. The `v_type` says what kind of version we want. """ if not type(plugins) is list: plugins = [plugins] deps = list() for plugin in plugins: for version in plugin['versions']: if utils.type_fits(version['type'], v_type): deps.extend(version['hard_dependencies']) break return deps
def select_newest_version(plugin, v_type="Release"): """ Return the newest version in plugin which is compatible `v_type`. """ for version in plugin['versions']: if utils.type_fits(version['type'], v_type): return version