mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-05-16 13:56:11 +08:00
Split utils/general.py
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.
This commit is contained in:
0
module_build_service/web/__init__.py
Normal file
0
module_build_service/web/__init__.py
Normal file
19
module_build_service/web/utils.py
Normal file
19
module_build_service/web/utils.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- 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()
|
||||
}
|
||||
Reference in New Issue
Block a user