Skip to content

Commit

Permalink
mesonlib: Use class syntax for defining MachineChoice
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dcbaker committed Feb 7, 2019
1 parent ced208f commit 9c48201
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mesonbuild/mesonlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,15 @@ def __lt__(self, other):
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):
Expand Down

0 comments on commit 9c48201

Please sign in to comment.