diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-06-19 21:13:35 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-08-01 22:00:06 -0700 |
commit | 5358765806909de8a7179c7becb3ee6ae1a54215 (patch) | |
tree | f08c90af51ce7b3c882dda9d16416451cd595470 | |
parent | 601789cc7ce3692fbefe14047d8b8cc68a3d5160 (diff) | |
download | meson-5358765806909de8a7179c7becb3ee6ae1a54215.zip meson-5358765806909de8a7179c7becb3ee6ae1a54215.tar.gz meson-5358765806909de8a7179c7becb3ee6ae1a54215.tar.bz2 |
mesonlib: Add repr() methods to PerMachine classes
Which is super helpful in debuggers
-rw-r--r-- | mesonbuild/mesonlib.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index a43d4c4..2c563e4 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -389,6 +389,9 @@ class PerMachine(T.Generic[_T]): unfreeze.host = None return unfreeze + def __repr__(self) -> str: + return 'PerMachine({!r}, {!r})'.format(self.build, self.host) + class PerThreeMachine(PerMachine[_T]): """Like `PerMachine` but includes `target` too. @@ -421,6 +424,9 @@ class PerThreeMachine(PerMachine[_T]): def matches_build_machine(self, machine: MachineChoice) -> bool: return self.build == self[machine] + def __repr__(self) -> str: + return 'PerThreeMachine({!r}, {!r}, {!r})'.format(self.build, self.host, self.target) + class PerMachineDefaultable(PerMachine[T.Optional[_T]]): """Extends `PerMachine` with the ability to default from `None`s. @@ -439,6 +445,9 @@ class PerMachineDefaultable(PerMachine[T.Optional[_T]]): freeze.host = freeze.build return freeze + def __repr__(self) -> str: + return 'PerMachineDefaultable({!r}, {!r})'.format(self.build, self.host) + class PerThreeMachineDefaultable(PerMachineDefaultable, PerThreeMachine[T.Optional[_T]]): """Extends `PerThreeMachine` with the ability to default from `None`s. @@ -460,6 +469,9 @@ class PerThreeMachineDefaultable(PerMachineDefaultable, PerThreeMachine[T.Option freeze.target = freeze.host return freeze + def __repr__(self) -> str: + return 'PerThreeMachineDefaultable({!r}, {!r}, {!r})'.format(self.build, self.host, self.target) + def is_sunos() -> bool: return platform.system().lower() == 'sunos' |