From 7247961aaea464d8b5d3e78d27280eef291e99c3 Mon Sep 17 00:00:00 2001 From: Davide Gardenal <davide.gardenal@huawei.com> Date: Tue, 26 Jul 2022 17:40:22 +0200 Subject: [PATCH] upgrade_oniro: add function to parse the manifest WIth get_manifest_projects we can now get a list of dicts containg all the properties of Oniro's projects used by repo. Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> --- scripts/upgrade_oniro/upgrade_oniro_utils.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade_oniro/upgrade_oniro_utils.py b/scripts/upgrade_oniro/upgrade_oniro_utils.py index 9a4d3f36..d3ecb7c9 100644 --- a/scripts/upgrade_oniro/upgrade_oniro_utils.py +++ b/scripts/upgrade_oniro/upgrade_oniro_utils.py @@ -1,3 +1,20 @@ # SPDX-FileCopyrightText: Huawei Inc. # -# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: Apache-2.0 +# +# Utils functions for upgrade_oniro.py + + +def get_manifest_projects(): + """ + Create a list of dict containing all the properties of the + projects in Oniro's manifest. + + Returns: + A new list of dict with all the projects' properties + """ + import xml.etree.ElementTree as ET + + tree = ET.parse("oniro/manifests/default.xml") + root = tree.getroot() + return [project.attrib for project in root.findall("project")] -- GitLab