1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

- util/debquery.py: workaround for python2.4's tarfile module

This commit is contained in:
Marcus Huewe 2010-12-04 12:11:34 +01:00
parent 42f8c595f9
commit 619ebdae8d

View File

@ -29,10 +29,14 @@ class DebQuery(packagequery.PackageQuery):
control = arfile.get_file('control.tar.gz') control = arfile.get_file('control.tar.gz')
if control is None: if control is None:
raise DebError(self.__path, 'missing control.tar.gz') raise DebError(self.__path, 'missing control.tar.gz')
# XXX: python24 relies on a name # XXX: python2.4 relies on a name
tar = tarfile.open(name = 'control.tar.gz', fileobj = control) tar = tarfile.open(name = 'control.tar.gz', fileobj = control)
try: try:
control = tar.extractfile('./control') name = './control'
# workaround for python2.4's tarfile module
if 'control' in tar.getnames():
name = 'control'
control = tar.extractfile(name)
except KeyError: except KeyError:
raise DebError(self.__path, 'missing \'control\' file in control.tar.gz') raise DebError(self.__path, 'missing \'control\' file in control.tar.gz')
self.__parse_control(control, all_tags, *extra_tags) self.__parse_control(control, all_tags, *extra_tags)