Introducing pyp2rpm - A python package to rpm specfile convertor

Konstantin Zemlyak zart at zartsoft.ru
Wed May 23 08:51:56 UTC 2012


Bohuslav Kabrda wrote:
>> line 154, in unpack_zipfile
>>      data = z.read(info.filename)
>>    File "/usr/lib64/python2.7/zipfile.py", line 869, in read
>>      return self.open(name, "r", pwd).read()
>>    File "/usr/lib64/python2.7/zipfile.py", line 683, in __init__
>>      raise RuntimeError, "That compression method is not supported"
>> RuntimeError: That compression method is not supported
>>

Same for me on F15.

> Yes, I can reproduce that. It seems to be a problem in the distribute package (a.k.a. python-setuptools in Fedora). I released version 0.4.1, that uses Python's internal distutils and should install fine. I will investigate this issue and let you know when I find out what's wrong.

No, it's a problem with your monkeypatching of zipfile in 
pyp2rpmlib/archive.py(12):

# monkey patch ZipFile to behave like TarFile
ZipFile.getmembers = ZipFile.infolist
ZipFile.extractfile = ZipFile.open
ZipFile.open = ZipFile # this line is at fault here
ZipInfo.name = ZipInfo.filename

Real zipfile.ZipFile.open opens member of archive not an archive itself.
So in code above z.read(info.filename) ends up calling ZipFile instead 
of real zipfile.ZipFile.open, providing wrong aruments.

-- 
Zart




More information about the python-devel mailing list