From 92d2aa13373111c83f4077009a0b33b61a5bb015 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 23 Apr 2009 02:35:59 +0000 Subject: Remove hacks for sets in python 2.3 Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5169 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/Pkgmgr.py | 14 ++++---------- src/sbin/bcfg2-repo-validate | 23 +++++++---------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/lib/Server/Plugins/Pkgmgr.py b/src/lib/Server/Plugins/Pkgmgr.py index 32a5bd400..49ac5bf26 100644 --- a/src/lib/Server/Plugins/Pkgmgr.py +++ b/src/lib/Server/Plugins/Pkgmgr.py @@ -1,18 +1,12 @@ '''This module implements a package management scheme for all images''' __revision__ = '$Revision$' -import logging, re, Bcfg2.Server.Plugin +import logging +import re +import Bcfg2.Server.Plugin logger = logging.getLogger('Bcfg2.Plugins.Pkgmgr') -try: - pdlist = set -except: - class pdlist(list): - def add(self, item): - if item not in self: - self.append(item) - class FuzzyDict(dict): fuzzy = re.compile('(?P.*):(?P\S+(,\S+)*)') def __getitem__(self, key): @@ -61,7 +55,7 @@ class PNode(Bcfg2.Server.Plugin.INode): def __init__(self, data, pdict, parent=None): # copy local attributes to all child nodes if no local attribute exists if not pdict.has_key('Package'): - pdict['Package'] = pdlist() + pdict['Package'] = set() for child in data.getchildren(): for attr in [key for key in data.attrib.keys() \ if key != 'name' and not child.attrib.has_key(key)]: diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate index e04cf6c3c..4c692e362 100755 --- a/src/sbin/bcfg2-repo-validate +++ b/src/sbin/bcfg2-repo-validate @@ -6,21 +6,12 @@ repos against their respective XML schemas ''' __revision__ = '$Revision$' -import glob, lxml.etree, os, sys - +import glob +import lxml.etree +import os +import sys import Bcfg2.Options -try: - pdlist = set -except NameError: - class pdlist(list): - def add(self, item): - if item not in self: - self.append(item) - def discard(self, item): - if item in self: - self.remove(item) - if __name__ == '__main__': opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY, 'prefix': Bcfg2.Options.INSTALL_PREFIX, @@ -46,10 +37,10 @@ if __name__ == '__main__': # get metadata list (with all included files) metadata_list = glob.glob("%s/Metadata/groups.xml" % repo) - ref_bundles = pdlist() + ref_bundles = set() xdata = lxml.etree.parse("%s/Metadata/groups.xml" % repo) - included = pdlist([ent.get('href') for ent in \ - xdata.findall('./{http://www.w3.org/2001/XInclude}include')]) + included = set([ent.get('href') for ent in \ + xdata.findall('./{http://www.w3.org/2001/XInclude}include')]) while included: try: filename = included.pop() -- cgit v1.2.3-1-g7c22