From a02de76190d611f5779b76e52bcf58026ab292e7 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 1 Jun 2022 17:03:41 +0000 Subject: [PATCH] sv_binutils: allow excluding enum values --- src/openpower/sv/sv_binutils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openpower/sv/sv_binutils.py b/src/openpower/sv/sv_binutils.py index bf348873..6ce8db19 100644 --- a/src/openpower/sv/sv_binutils.py +++ b/src/openpower/sv/sv_binutils.py @@ -135,12 +135,15 @@ class Void(CType, typedef="void"): class EnumMeta(_enum.EnumMeta, CTypeMeta): - def __call__(metacls, name, entries, tag=None, **kwargs): + def __call__(metacls, name, entries, tag=None, exclude=None, **kwargs): + if exclude is None: + exclude = frozenset() if isinstance(entries, type) and issubclass(entries, _enum.Enum): # Use __members__, not __iter__, otherwise aliases are lost. entries = dict(entries.__members__) if isinstance(entries, dict): entries = tuple(entries.items()) + entries = ((key, value) for (key, value) in entries if key not in exclude) if tag is None: tag = f"svp64_{name.lower()}" -- 2.30.2