From dc2b9574c95c6f59f7bb2ede7c11cbc3c781399c Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 26 Mar 2025 11:07:41 +0100 Subject: [PATCH] saip-tool: allow removing of profile elements by type At the moment it is only possible to remove profile elements by their identification number. However, there may be cases where we want to remove all profile elements of a certain type at once (e.g. when removing all applications). Change-Id: I92f9f9d5b4382242963f1b3ded814a0d013c4808 --- contrib/saip-tool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/saip-tool.py b/contrib/saip-tool.py index c2115a61..64aba933 100755 --- a/contrib/saip-tool.py +++ b/contrib/saip-tool.py @@ -54,7 +54,8 @@ parser_rpe.add_argument('--identification', type=int, help='Extract PE matching parser_rpe = subparsers.add_parser('remove-pe', help='Remove specified PEs from PE-Sequence') parser_rpe.add_argument('--output-file', required=True, help='Output file name') -parser_rpe.add_argument('--identification', type=int, action='append', help='Remove PEs matching specified identification') +parser_rpe.add_argument('--identification', default=[], type=int, action='append', help='Remove PEs matching specified identification') +parser_rpe.add_argument('--type', default=[], action='append', help='Remove PEs matching specified type') parser_rn = subparsers.add_parser('remove-naa', help='Remove speciifed NAAs from PE-Sequence') parser_rn.add_argument('--output-file', required=True, help='Output file name') @@ -146,6 +147,9 @@ def do_remove_pe(pes: ProfileElementSequence, opts): if identification in opts.identification: print("Removing PE %s (id=%u) from Sequence..." % (pe, identification)) continue + if pe.type in opts.type: + print("Removing PE %s (type=%s) from Sequence..." % (pe, pe.type)) + continue new_pe_list.append(pe) pes.pe_list = new_pe_list