[yum-git] yum/comps.py yum/__init__.py
Seth Vidal
skvidal at linux.duke.edu
Thu Jun 19 03:28:49 UTC 2008
yum/__init__.py | 4 ----
yum/comps.py | 11 +++++++++--
2 files changed, 9 insertions(+), 6 deletions(-)
New commits:
commit b0d33e52ed062d5a88f455b954a89dd825c82cd6
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Jun 18 15:16:32 2008 -0400
move .gz and .bz2 comps file support into comps, out of yum.
diff --git a/yum/__init__.py b/yum/__init__.py
index d727dcd..5786816 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -571,10 +571,6 @@ class YumBase(depsolve.Depsolve):
vdebug1(_('Adding group file from repository: %s'), repo)
groupfile = repo.getGroups()
- # open it up as a file object so iterparse can cope with our gz file
- if groupfile is not None and groupfile.endswith('.gz'):
- groupfile = gzip.open(groupfile)
-
try:
self._comps.add(groupfile)
except (Errors.GroupsError,Errors.CompsException), e:
diff --git a/yum/comps.py b/yum/comps.py
index 1dc303e..951789b 100755
--- a/yum/comps.py
+++ b/yum/comps.py
@@ -25,6 +25,8 @@ from Errors import CompsException
# switch all compsexceptions to grouperrors after api break
import fnmatch
import re
+import gzip
+import bz2
from yum.misc import to_unicode
lang_attr = '{http://www.w3.org/XML/1998/namespace}lang'
@@ -51,7 +53,7 @@ class Group(object):
self.optional_packages = {}
self.default_packages = {}
self.conditional_packages = {}
- self.langonly = None ## what the hell is this?
+ self.langonly = None
self.groupid = None
self.display_order = 1024
self.installed = False
@@ -431,7 +433,12 @@ class Comps(object):
if type(srcfile) == type('str'):
# srcfile is a filename string
- infile = open(srcfile, 'rt')
+ if srcfile.endswith('.gz'):
+ infile = gzip.open(srcfile, 'r')
+ elif srcfile.endswith('.bz2'):
+ infile = bz2.BZ2File(srcfile, 'r')
+ else:
+ infile = open(srcfile, 'rt')
else:
# srcfile is a file object
infile = srcfile
More information about the Yum-cvs-commits
mailing list