From 756ea32e068e60ece210561edc2dee523826f472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 12 Feb 2021 12:22:20 +0100
Subject: [PATCH] Don't access other enum members from self
This is deprecated in Python 3.10.
Instead, acces them from the class.
Fixes https://github.com/mesonbuild/meson/issues/8318
---
mesonbuild/backend/backends.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index ecd506789d..743574b110 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -69,11 +69,12 @@ def from_str(cls, string: str) -> 'TestProtocol':
raise MesonException('unknown test format {}'.format(string))
def __str__(self) -> str:
- if self is self.EXITCODE:
+ cls = type(self)
+ if self is cls.EXITCODE:
return 'exitcode'
- elif self is self.GTEST:
+ elif self is cls.GTEST:
return 'gtest'
- elif self is self.RUST:
+ elif self is cls.RUST:
return 'rust'
return 'tap'