From e3fb140c8d44d751766535eedefcc4ada6544bd1 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Mon, 22 Dec 2008 04:09:48 +0000 Subject: Update dictionary accesses to work with Python 3.0 git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4999 ce84e21b-d406-0410-9b95-82705330c041 --- tools/create-debian-pkglist-gp.py | 6 +++--- tools/create-debian-pkglist.py | 6 +++--- tools/pkgmgr_update.py | 4 ++-- tools/rpmlisting.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/create-debian-pkglist-gp.py b/tools/create-debian-pkglist-gp.py index 02c93815c..ae038e056 100644 --- a/tools/create-debian-pkglist-gp.py +++ b/tools/create-debian-pkglist-gp.py @@ -106,8 +106,8 @@ Source URLS: %s""" % (self.filename, self.groups, self.priority, self.architectu pkgname = line.split(' ')[1].strip() elif line[:8] == 'Version:': version = line.split(' ')[1].strip() - if pkgdata.has_key(pkgname): - if pkgdata[pkgname].has_key(arch): + if pkgname in pkgdata: + if arch in pkgdata[pkgname]: # The package is listed twice for the same architecture # We keep the most recent version old_version = pkgdata[pkgname][arch] @@ -161,7 +161,7 @@ Source URLS: %s""" % (self.filename, self.groups, self.priority, self.architectu self._write_to_file('' % (arch)) self.indent_level = self.indent_level + 1 for pkg in self._get_sorted_pkg_keys(pkgdata): - if pkgdata[pkg].has_key(arch): + if arch in pkgdata[pkg]: self._write_to_file('' % (pkg, pkgdata[pkg][arch])) #perarch += 1 self.indent_level = self.indent_level - 1 diff --git a/tools/create-debian-pkglist.py b/tools/create-debian-pkglist.py index f64a2ed1f..9761d43ac 100755 --- a/tools/create-debian-pkglist.py +++ b/tools/create-debian-pkglist.py @@ -37,13 +37,13 @@ def processSource(prefix, source, dists, archs, prio, groups, packages): pkgname = line.split(' ')[1].strip() elif line[:8] == 'Version:': version = line.split(' ')[1].strip() - if pkgdata.has_key(pkgname): + if pkgname in pkgdata: pkgdata[pkgname][arch] = version else: pkgdata[pkgname] = {arch:version} elif line[:8] == 'Depends:': deps = re.sub(',', '', re.sub('\(.*\)', '', line)).split()[1:] - if pkgdeps.has_key(pkgname): + if pkgname in pkgdeps: pkgdeps[pkgname][arch] = deps else: pkgdeps[pkgname] = {arch:deps} @@ -69,7 +69,7 @@ def processSource(prefix, source, dists, archs, prio, groups, packages): for arch in archs: output.write('\n' % (arch)) for pkg in pkgdata.keys(): - if pkgdata[pkg].has_key(arch): + if arch in pkgdata[pkg]: output.write('\n' % (pkg, pkgdata[pkg][arch])) perarch += 1 output.write('\n') diff --git a/tools/pkgmgr_update.py b/tools/pkgmgr_update.py index 57c92452b..9f7a1fa98 100755 --- a/tools/pkgmgr_update.py +++ b/tools/pkgmgr_update.py @@ -239,8 +239,8 @@ def updatepkg(pkg): if name not in installOnlyPkgs: for inst in [inst for inst in pkg if inst.tag == 'Instance']: arch = inst.get('arch') - if package_dict.has_key(name): - if package_dict[name].has_key(arch): + if name in package_dict: + if arch in package_dict[name]: package_dict[name][arch].sort(cmpRpmHeader) latest = package_dict[name][arch][-1] if cmpRpmHeader(inst, latest) == -1: diff --git a/tools/rpmlisting.py b/tools/rpmlisting.py index 9cc1d2580..41b4772a0 100644 --- a/tools/rpmlisting.py +++ b/tools/rpmlisting.py @@ -162,7 +162,7 @@ pkgs = { for filename in rpms: (name, version, release, subarch) = parse_rpm_filename(rpmdir, filename) rpmblob = {'file':filename, 'name':name, 'version':version, 'release':release, 'subarch':subarch} - if pkgs.has_key(name): + if name in pkgs: pkgs[name].append(rpmblob) else: pkgs[name] = [rpmblob] -- cgit v1.2.3-1-g7c22