From 0eccce799f5643dda7a65f3e841cd54785f03ec5 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 8 Jan 2019 09:24:22 -0800 Subject: mesonlib: Use class syntax for defining MachineChoice Mypy struggles with the imperative form of Enum declaration, and upstream doesn't consider it a bug, they recomend using the class form for enums that are going to be externally exposed. --- mesonbuild/mesonlib.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mesonbuild') diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 540fcdc..9a55c26 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -308,7 +308,15 @@ class OrderedEnum(Enum): return self.value < other.value return NotImplemented -MachineChoice = OrderedEnum('MachineChoice', ['BUILD', 'HOST', 'TARGET']) +class MachineChoice(OrderedEnum): + + """Enum class representing one of the three possible values for binaries, + the build, host, and target machines. + """ + + BUILD = 0 + HOST = 1 + TARGET = 2 class PerMachine: def __init__(self, build, host, target): -- cgit v1.1