X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FMisc.py;h=731bbf14584b7a610e412a7c716fe83ed3284e5e;hp=d6a796bd2b1ec46cab2807205d92035c0064f3a7;hb=79b74a03e018ecbf03d8d50e6f20301e249c1ba5;hpb=4d10ab79d771f6ad88f54db324a7ac184118ccf7 diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index d6a796bd2b..731bbf1458 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1396,6 +1396,27 @@ class PathClass(object): else: return self.Path == str(Other) + ## Override __cmp__ function + # + # Customize the comparsion operation of two PathClass + # + # @retval 0 The two PathClass are different + # @retval -1 The first PathClass is less than the second PathClass + # @retval 1 The first PathClass is Bigger than the second PathClass + def __cmp__(self, Other): + if type(Other) == type(self): + OtherKey = Other.Path + else: + OtherKey = str(Other) + + SelfKey = self.Path + if SelfKey == OtherKey: + return 0 + elif SelfKey > OtherKey: + return 1 + else: + return -1 + ## Override __hash__ function # # Use Path as key in hash table