Exemplo n.º 1
0
	def __lt__(self, other):
		if not isinstance(other, self.__class__):
			err = "other isn't of %s type, is %s"
			raise TypeError(err % (self.__class__, other.__class__))

		if self.operator != other.operator:
			return self.operator < other.operator

		if not CPV.__eq__(self, other):
			return CPV.__lt__(self, other)

		if bool(self.blocker) != bool(other.blocker):
			# We want non blockers, then blockers, so only return True
			# if self.blocker is True and other.blocker is False.
			return bool(self.blocker) > bool(other.blocker)

		if self.blocker and other.blocker:
			if self.blocker.overlap.forbid != other.blocker.overlap.forbid:
				# we want !! prior to !
				return (self.blocker.overlap.forbid <
					other.blocker.overlap.forbid)

		# Don't believe Portage has something like this
		#c = cmp(self.negate_vers, other.negate_vers)
		#if c:
		#   return c

		if self.slot != other.slot:
			if self.slot is None:
				return False
			elif other.slot is None:
				return True
			return self.slot < other.slot

		this_use = []
		if self.use is not None:
			this_use = sorted(self.use.tokens)
		that_use = []
		if other.use is not None:
			that_use = sorted(other.use.tokens)
		if this_use != that_use:
			return this_use < that_use

		# Not supported by Portage Atom yet
		#return cmp(self.repo_name, other.repo_name)

		return False
Exemplo n.º 2
0
    def __lt__(self, other):
        if not isinstance(other, self.__class__):
            err = "other isn't of %s type, is %s"
            raise TypeError(err % (self.__class__, other.__class__))

        if self.operator != other.operator:
            return self.operator < other.operator

        if not CPV.__eq__(self, other):
            return CPV.__lt__(self, other)

        if bool(self.blocker) != bool(other.blocker):
            # We want non blockers, then blockers, so only return True
            # if self.blocker is True and other.blocker is False.
            return bool(self.blocker) > bool(other.blocker)

        if self.blocker and other.blocker:
            if self.blocker.overlap.forbid != other.blocker.overlap.forbid:
                # we want !! prior to !
                return (self.blocker.overlap.forbid <
                        other.blocker.overlap.forbid)

        # Don't believe Portage has something like this
        #c = cmp(self.negate_vers, other.negate_vers)
        #if c:
        #   return c

        if self.slot != other.slot:
            if self.slot is None:
                return False
            elif other.slot is None:
                return True
            return self.slot < other.slot

        this_use = []
        if self.use is not None:
            this_use = sorted(self.use.tokens)
        that_use = []
        if other.use is not None:
            that_use = sorted(other.use.tokens)
        if this_use != that_use:
            return this_use < that_use

        # Not supported by Portage Atom yet
        #return cmp(self.repo_name, other.repo_name)

        return False
Exemplo n.º 3
0
	def __eq__(self, other):
		if not isinstance(other, self.__class__):
			err = "other isn't of %s type, is %s"
			raise TypeError(err % (self.__class__, other.__class__))

		if self.operator != other.operator:
			return False

		if not CPV.__eq__(self, other):
			return False

		if bool(self.blocker) != bool(other.blocker):
			return False

		if self.blocker and other.blocker:
			if self.blocker.overlap.forbid != other.blocker.overlap.forbid:
				return False

		if self.use_conditional != other.use_conditional:
			return False

		# Don't believe Portage has something like this
		#c = cmp(self.negate_vers, other.negate_vers)
		#if c:
		#   return c

		if self.slot != other.slot:
			return False

		this_use = None
		if self.use is not None:
			this_use = sorted(self.use.tokens)
		that_use = None
		if other.use is not None:
			that_use = sorted(other.use.tokens)
		if this_use != that_use:
			return False

		# Not supported by Portage Atom yet
		#return cmp(self.repo_name, other.repo_name)
		return True
Exemplo n.º 4
0
    def __eq__(self, other):
        if not isinstance(other, self.__class__):
            err = "other isn't of %s type, is %s"
            raise TypeError(err % (self.__class__, other.__class__))

        if self.operator != other.operator:
            return False

        if not CPV.__eq__(self, other):
            return False

        if bool(self.blocker) != bool(other.blocker):
            return False

        if self.blocker and other.blocker:
            if self.blocker.overlap.forbid != other.blocker.overlap.forbid:
                return False

        if self.use_conditional != other.use_conditional:
            return False

        # Don't believe Portage has something like this
        #c = cmp(self.negate_vers, other.negate_vers)
        #if c:
        #   return c

        if self.slot != other.slot:
            return False

        this_use = None
        if self.use is not None:
            this_use = sorted(self.use.tokens)
        that_use = None
        if other.use is not None:
            that_use = sorted(other.use.tokens)
        if this_use != that_use:
            return False

        # Not supported by Portage Atom yet
        #return cmp(self.repo_name, other.repo_name)
        return True