mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 10:20:31 +08:00
This puts backend specific code in either the builder or scheduler subpackage. This puts API specific code in the new web subpackage. Lastly, any code shared between the API and backend is placed in the common subpackage.
20 lines
672 B
Python
20 lines
672 B
Python
# -*- coding: utf-8 -*-
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
def deps_to_dict(deps, deps_type):
|
|
"""
|
|
Helper method to convert a Modulemd.Dependencies object to a dictionary.
|
|
|
|
:param Modulemd.Dependencies deps: the Modulemd.Dependencies object to convert
|
|
:param str deps_type: the type of dependency (buildtime or runtime)
|
|
:return: a dictionary with the keys as module names and values as a list of strings
|
|
:rtype dict
|
|
"""
|
|
names_func = getattr(deps, 'get_{}_modules'.format(deps_type))
|
|
streams_func = getattr(deps, 'get_{}_streams'.format(deps_type))
|
|
return {
|
|
module: streams_func(module)
|
|
for module in names_func()
|
|
}
|