diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-04-23 02:35:59 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-04-23 02:35:59 +0000 |
commit | 92d2aa13373111c83f4077009a0b33b61a5bb015 (patch) | |
tree | bab80e5b4f8a4d8fc0214206806b68b0c7472279 /src | |
parent | bfff630862e73faf07b79c9b4a504086f663485b (diff) | |
download | bcfg2-92d2aa13373111c83f4077009a0b33b61a5bb015.tar.gz bcfg2-92d2aa13373111c83f4077009a0b33b61a5bb015.tar.bz2 bcfg2-92d2aa13373111c83f4077009a0b33b61a5bb015.zip |
Remove hacks for sets in python 2.3
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5169 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Plugins/Pkgmgr.py | 14 | ||||
-rwxr-xr-x | 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<name>.*):(?P<alist>\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() |