Exemplo n.º 1
0
    def __init__(self, query, is_regex=False):
        """Create query object.

		@type is_regex: bool
		@param is_regex: query is a regular expression
		"""

        # We need at least one of these chars for a valid query
        needed_chars = ascii_letters + '*'
        if not set(query).intersection(needed_chars):
            raise errors.GentoolkitInvalidPackage(query)

        # Separate repository
        repository = None
        if query.count(':') == 2:
            query, repository = query.rsplit(':', 1)
        self.query = query.rstrip(':')  # Don't leave dangling colon
        self.repo_filter = repository
        self.is_regex = is_regex
        self.query_type = self._get_query_type()

        # Name the rest of the chunks, if possible
        if self.query_type != "set":
            try:
                atom = Atom(self.query)
                self.__dict__.update(atom.__dict__)
            except errors.GentoolkitInvalidAtom:
                CPV.__init__(self, self.query)
                self.operator = ''
                self.atom = self.cpv
Exemplo n.º 2
0
	def __init__(self, query, is_regex=False):
		"""Create query object.

		@type is_regex: bool
		@param is_regex: query is a regular expression
		"""

		# We need at least one of these chars for a valid query
		needed_chars = ascii_letters + '*'
		if not set(query).intersection(needed_chars):
			raise errors.GentoolkitInvalidPackage(query)

		# Separate repository
		repository = None
		if query.count(':') == 2:
			query, repository = query.rsplit(':', 1)
		self.query = query.rstrip(':') # Don't leave dangling colon
		self.repo_filter = repository
		self.is_regex = is_regex
		self.query_type = self._get_query_type()

		# Name the rest of the chunks, if possible
		if self.query_type != "set":
			try:
				atom = Atom(self.query)
				self.__dict__.update(atom.__dict__)
			except errors.GentoolkitInvalidAtom:
				CPV.__init__(self, self.query)
				self.operator = ''
				self.atom = self.cpv
Exemplo n.º 3
0
	def __init__(self, atom):
		self.atom = atom
		self.operator = self.blocker = self.use = self.slot = None

		try:
			portage.dep.Atom.__init__(self, atom)
		except portage.exception.InvalidAtom:
			raise errors.GentoolkitInvalidAtom(atom)

		# Make operator compatible with intersects
		if self.operator is None:
			self.operator = ''

		CPV.__init__(self, self.cpv)

		# use_conditional is USE flag condition for this Atom to be required:
		# For: !build? ( >=sys-apps/sed-4.0.5 ), use_conditional = '!build'
		self.use_conditional = None
Exemplo n.º 4
0
    def __init__(self, atom):
        self.atom = atom
        self.operator = self.blocker = self.use = self.slot = None

        try:
            portage.dep.Atom.__init__(self, atom)
        except portage.exception.InvalidAtom:
            raise errors.GentoolkitInvalidAtom(atom)

        # Make operator compatible with intersects
        if self.operator is None:
            self.operator = ''

        CPV.__init__(self, self.cpv)

        # use_conditional is USE flag condition for this Atom to be required:
        # For: !build? ( >=sys-apps/sed-4.0.5 ), use_conditional = '!build'
        self.use_conditional = None
Exemplo n.º 5
0
    def __init__(self, cpv, validate=False, local_config=True):
        if isinstance(cpv, CPV):
            self.__dict__.update(cpv.__dict__)
        else:
            CPV.__init__(self, cpv, validate=validate)

        if validate and not all(
                hasattr(self, x) for x in ('category', 'version')):
            # CPV allows some things that Package must not
            raise errors.GentoolkitInvalidPackage(self.cpv)

        if local_config:
            self._settings = default_settings
        else:
            self._settings = nolocal_settings

        # Set dynamically
        self._package_path = None
        self._dblink = None
        self._metadata = None
        self._deps = None
        self._portdir_path = None
Exemplo n.º 6
0
	def __init__(self, cpv, validate=False, local_config=True):
		if isinstance(cpv, CPV):
			self.__dict__.update(cpv.__dict__)
		else:
			CPV.__init__(self, cpv, validate=validate)

		if validate and not all(
			hasattr(self, x) for x in ('category', 'version')
		):
			# CPV allows some things that Package must not
			raise errors.GentoolkitInvalidPackage(self.cpv)

		if local_config:
			self._settings = default_settings
		else:
			self._settings = nolocal_settings

		# Set dynamically
		self._package_path = None
		self._dblink = None
		self._metadata = None
		self._deps = None
		self._portdir_path = None