both python 2.x and 3.x.
svn path=/main/trunk/; revision=14385
if self.modified:
self.header["TIMESTAMP"] = str(long(time.time()))
self.header["PACKAGES"] = str(len(self.packages))
- keys = list(self.header.keys())
+ keys = list(self.header)
keys.sort()
self._writepkgindex(pkgfile, [(k, self.header[k]) \
for k in keys if self.header[k]])
for k, v in self._default_pkg_data.items():
if metadata.get(k) == v:
metadata.pop(k, None)
- keys = list(metadata.keys())
+ keys = list(metadata)
keys.sort()
self._writepkgindex(pkgfile,
[(k, metadata[k]) for k in keys if metadata[k]])
outstream.write(_("Announced on: %s\n") % self.announced)
outstream.write(_("Last revised on: %s : %02d\n\n") % (self.revised, self.count))
if self.glsatype == "ebuild":
- for k in self.packages.keys():
+ for k in self.packages:
pkg = self.packages[k]
for path in pkg:
vul_vers = "".join(path["vul_vers"])
@returns: True if the system is affected, False if not
"""
rValue = False
- for k in self.packages.keys():
+ for k in self.packages:
pkg = self.packages[k]
for path in pkg:
if path["arch"] == "*" or self.config["ARCH"] in path["arch"].split():
@return: list of package-versions that have to be merged
"""
rValue = []
- for pkg in self.packages.keys():
+ for pkg in self.packages:
for path in self.packages[pkg]:
update = getMinUpgrade(path["vul_atoms"], path["unaff_atoms"], \
self.portdbapi, self.vardbapi, minimize=least_change)
class Manifest2Entry(ManifestEntry):
def __str__(self):
myline = " ".join([self.type, self.name, str(self.hashes["size"])])
- myhashkeys = list(self.hashes.keys())
+ myhashkeys = list(self.hashes)
myhashkeys.remove("size")
myhashkeys.sort()
for h in myhashkeys:
return myhashdict
def _createManifestEntries(self):
- mytypes = list(self.fhashdict.keys())
+ mytypes = list(self.fhashdict)
mytypes.sort()
for t in mytypes:
- myfiles = list(self.fhashdict[t].keys())
+ myfiles = list(self.fhashdict[t])
myfiles.sort()
for f in myfiles:
myentry = Manifest2Entry(
type=t, name=f, hashes=self.fhashdict[t][f].copy())
- myhashkeys = list(myentry.hashes.keys())
+ myhashkeys = list(myentry.hashes)
myhashkeys.sort()
for h in myhashkeys:
if h not in ["size"] + portage.const.MANIFEST2_HASH_FUNCTIONS:
rev_transform[atom] = atom
else:
rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom
- best_match = best_match_to_list(pkg, iter(rev_transform.keys()))
+ best_match = best_match_to_list(pkg, iter(rev_transform))
if best_match:
return rev_transform[best_match]
return None
raise SetConfigError(_("no includes or excludes given"))
metadatadb = options.get("metadata-source", "vartree")
- if not metadatadb in trees.keys():
+ if not metadatadb in trees:
raise SetConfigError(_("invalid value '%s' for option metadata-source") % metadatadb)
return cls(trees["vartree"].dbapi,
data = {}
if self.greedy:
atoms = []
- for a in data.keys():
+ for a in data:
matches = self.dbapi.match(a)
for cpv in matches:
atoms.append("%s:%s" % (cpv_getkey(cpv),
# in the latest new slot that may be available.
atoms.append(a)
else:
- atoms = list(data.keys())
+ atoms = iter(data)
self._setAtoms(atoms)
self._mtime = mtime
def load(self):
data, errors = self.loader.load()
- self._setAtoms(list(data.keys()))
+ self._setAtoms(iter(data))
def singleBuilder(self, options, settings, trees):
if not "filename" in options:
raise
del e
data = {}
- atoms = list(data.keys())
+ atoms = list(data)
self._mtime = mtime
atoms_changed = True
else:
raise
del e
data = {}
- nonatoms = list(data.keys())
+ nonatoms = list(data)
self._mtime2 = mtime
atoms_changed = True
else:
return None
if final_dict is None:
final_dict = {}
- for y in list(mydict.keys()):
+ for y in mydict:
if True:
if y in final_dict and (incremental or (y in incrementals)):
final_dict[y] += " "+mydict[y][:]
else:
final_dict[y] = mydict[y][:]
- mydict[y] = " ".join(mydict[y].split()) # Remove extra spaces.
return final_dict
def stack_lists(lists, incremental=1):
new_list[y] = True
else:
new_list[y] = True
- return list(new_list.keys())
+ return list(new_list)
def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
"""