diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-07-09 22:00:49 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-07-09 22:00:49 +0200 |
commit | 01fa05da0d80aab1aa1526a5302b3a798d0f0179 (patch) | |
tree | 90d4d694eb62fd707a64e19d6ac26a6f125d16ee /portato | |
parent | 09f790063e70515fbcb828676f639740b1c67885 (diff) | |
download | portato-01fa05da0d80aab1aa1526a5302b3a798d0f0179.tar.gz portato-01fa05da0d80aab1aa1526a5302b3a798d0f0179.tar.bz2 portato-01fa05da0d80aab1aa1526a5302b3a798d0f0179.zip |
Renamed generic package sets
Diffstat (limited to '')
-rw-r--r-- | portato/backend/portage/package.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 30 | ||||
-rw-r--r-- | portato/backend/system_interface.py | 7 | ||||
-rw-r--r-- | portato/gui/queue.py | 4 | ||||
-rw-r--r-- | portato/gui/utils.py | 2 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 2 |
6 files changed, 26 insertions, 21 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 78125ee..351b7e0 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -226,7 +226,7 @@ class PortagePackage (Package): for dep in deps: if dep[0] == '!': # blocking sth - blocked = system.find_packages(dep, "installed") + blocked = system.find_packages(dep, system.SET_INSTALLED) if len(blocked) == 1: # only exact one match allowed to be harmless if blocked[0].get_slot_cp() == self.get_slot_cp(): # blocks in the same slot are harmless continue diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 246f20c..edbb4f0 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -174,16 +174,16 @@ class PortageSystem (SystemInterface): t = [] if not only_installed: - pkgSet = "tree" + pkgSet = self.SET_TREE else: - pkgSet = "installed" + pkgSet = self.SET_INSTALLED t = self.find_packages(search_key, pkgSet = pkgSet, masked = masked, with_version = True, only_cpv = True) if VERSION >= (2,1,5): - t += [pkg.get_cpv() for pkg in self.find_packages(search_key, "installed") if not (pkg.is_testing(True) or pkg.is_masked())] + t += [pkg.get_cpv() for pkg in self.find_packages(search_key, self.SET_INSTALLED) if not (pkg.is_testing(True) or pkg.is_masked())] else: - t = self.find_packages(search_key, "installed", only_cpv=True) + t = self.find_packages(search_key, self.SET_INSTALLED, only_cpv=True) if t: t = unique_array(t) @@ -191,7 +191,7 @@ class PortageSystem (SystemInterface): return None - def find_packages (self, key = "", pkgSet = "all", masked = False, with_version = True, only_cpv = False): + def find_packages (self, key = "", pkgSet = SystemInterface.SET_ALL, masked = False, with_version = True, only_cpv = False): if key is None: key = "" is_regexp = key == "" or ("*" in key and key[0] not in ("*","=","<",">","~","!")) @@ -261,12 +261,12 @@ class PortageSystem (SystemInterface): yield self.find_best_match(cp, only_cpv = True) funcmap = { - "all" : all, - "installed" : installed, - "uninstalled" : uninstalled, + self.SET_ALL : all, + self.SET_INSTALLED : installed, + self.SET_UNINSTALLED : uninstalled, + self.SET_TREE : tree, "world" : world, - "system" : system, - "tree" : tree + "system" : system } pkgSet = pkgSet.lower() @@ -316,7 +316,7 @@ class PortageSystem (SystemInterface): new_packages = [] for p in packages: - inst = self.find_packages(p, "installed") + inst = self.find_packages(p, self.SET_INSTALLED) best_p = self.find_best_match(p) if best_p is None: @@ -342,7 +342,7 @@ class PortageSystem (SystemInterface): return new_packages def get_updated_packages (self): - packages = self.get_new_packages(self.find_packages(pkgSet = "installed", with_version = False)) + packages = self.get_new_packages(self.find_packages(pkgSet = self.SET_INSTALLED, with_version = False)) packages = [x for x in packages if x is not None and not x.is_installed()] return packages @@ -374,11 +374,11 @@ class PortageSystem (SystemInterface): tempDeep = False if not p.is_installed(): - oldList = self.find_packages(p.get_slot_cp(), "installed") + oldList = self.find_packages(p.get_slot_cp(), self.SET_INSTALLED) if oldList: old = oldList[0] # we should only have one package here - else it is a bug else: - oldList = self.sort_package_list(self.find_packages(p.get_cp(), "installed")) + oldList = self.sort_package_list(self.find_packages(p.get_cp(), self.SET_INSTALLED)) if not oldList: info(_("Found a not installed dependency: %s.") % p.get_cpv()) oldList = [p] @@ -428,7 +428,7 @@ class PortageSystem (SystemInterface): if not pkg: continue if not pkg.is_installed() and (pkg.is_masked() or pkg.is_testing(True)): # check to not update unnecessairily cont = False - for inst in self.find_packages(pkg.get_cp(), "installed", only_cpv = True): + for inst in self.find_packages(pkg.get_cp(), self.SET_INSTALLED, only_cpv = True): if self.cpv_matches(inst, i): debug("The installed %s matches %s. Discarding upgrade to masked version.", inst, i) cont = True diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py index c118f6d..1cb0ed1 100644 --- a/portato/backend/system_interface.py +++ b/portato/backend/system_interface.py @@ -11,6 +11,11 @@ # Written by René 'Necoro' Neumann <necoro@necoro.net> class SystemInterface (object): + + SET_ALL = "__portato_all__" + SET_TREE = "__portato_tree__" + SET_INSTALLED = "__portato_installed__" + SET_UNINSTALLED = "__portato_uninstalled__" def has_set_support (self): """Signals, whether this backend supports sets. @@ -90,7 +95,7 @@ class SystemInterface (object): raise NotImplementedError - def find_packages (self, key, pkgSet = "all", masked = False, with_version = True, only_cpv = False): + def find_packages (self, key, pkgSet = SET_ALL, masked = False, with_version = True, only_cpv = False): """This returns a list of packages matching the key. As key, it is allowed to use basic regexps (".*") and the normal package specs. But not a combination of them. diff --git a/portato/gui/queue.py b/portato/gui/queue.py index ce7e620..cb5b334 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -143,7 +143,7 @@ class EmergeQueue: try: pkg = self._get_pkg_from_cpv(cpv, unmask) if not pkg.is_installed(): - old = system.find_packages(pkg.get_slot_cp(), "installed") + old = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if old: old = old[0] # assume we have only one there cmp = pkg.compare_version(old) @@ -272,7 +272,7 @@ class EmergeQueue: # get the blocks that block an installed package inst = [] for block in self.blocks[type]: - pkgs = system.find_packages(block, "installed") + pkgs = system.find_packages(block, system.SET_INSTALLED) if pkgs: inst.append((pkgs, block)) diff --git a/portato/gui/utils.py b/portato/gui/utils.py index 035d1c6..a4e1e6e 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -185,7 +185,7 @@ class Database (object): # get the lists packages = system.find_packages(category, with_version = False) - installed = system.find_packages(category, "installed", with_version = False) + installed = system.find_packages(category, system.SET_INSTALLED, with_version = False) # cycle through packages for p in packages: diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 8f456d9..188a5e1 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1315,7 +1315,7 @@ class MainWindow (Window): if pkg.is_installed(): installed = set(pkg.get_iuse_flags()).intersection(pkg.get_installed_use_flags()) else: - inst = system.find_packages(pkg.get_slot_cp(), "installed") + inst = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if inst: installed = set(inst[0].get_iuse_flags()).intersection(inst[0].get_installed_use_flags()) else: |