diff options
author | Mathieu Bridon <bochecha@daitauha.fr> | 2018-07-17 22:57:39 +0200 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-08-07 13:10:34 -0700 |
commit | e1b88aee680bbdadd283b4a26db74672bb130df5 (patch) | |
tree | aa7b7026af801eae5202200e5ad10e861a543145 /src/intel | |
parent | 9b6746b7c0bef64be419c8cf2ecd916980e2718a (diff) | |
download | mesa-e1b88aee680bbdadd283b4a26db74672bb130df5.tar.gz mesa-e1b88aee680bbdadd283b4a26db74672bb130df5.tar.bz2 mesa-e1b88aee680bbdadd283b4a26db74672bb130df5.zip |
python: Fix rich comparisons
Python 3 doesn't call objects __cmp__() methods any more to compare
them. Instead, it requires implementing the rich comparison methods
explicitly: __eq__(), __ne(), __lt__(), __le__(), __gt__() and __ge__().
Fortunately Python 2 also supports those.
This commit only implements the comparison methods which are actually
used by the build scripts.
Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_extensions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index cffc3e700cb..9a65aed1c46 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -160,14 +160,15 @@ class VkVersion: patch = self.patch if self.patch is not None else 0 return (self.major << 22) | (self.minor << 12) | patch - def __cmp__(self, other): + def __gt__(self, other): # If only one of them has a patch version, "ignore" it by making # other's patch version match self. if (self.patch is None) != (other.patch is None): other = copy.copy(other) other.patch = self.patch - return self.__int_ver().__cmp__(other.__int_ver()) + return self.__int_ver() > other.__int_ver() + MAX_API_VERSION = VkVersion('0.0.0') |