diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-01-08 09:24:22 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-02-11 12:50:32 -0800 |
commit | 0eccce799f5643dda7a65f3e841cd54785f03ec5 (patch) | |
tree | fdaffcd133e1fb4218520873ce3f922e0cf84b9f | |
parent | b5d847e38c90292af351ff4aa99cef0300886660 (diff) | |
download | meson-0eccce799f5643dda7a65f3e841cd54785f03ec5.zip meson-0eccce799f5643dda7a65f3e841cd54785f03ec5.tar.gz meson-0eccce799f5643dda7a65f3e841cd54785f03ec5.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/mesonlib.py | 10 |
1 files changed, 9 insertions, 1 deletions
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): |