def _read_manifest(self):
mf = None
if self._path.endswith("/META-INF/MANIFEST.MF"):
mf = open(self._path, "rb")
if zipfile.is_zipfile(self._path):
# looks like "zipfile.is_zipfile()" is not reliable
# see rhbz#889131 for more details
try:
jarfile = ZipFile(self._path)
if "META-INF/MANIFEST.MF" in jarfile.namelist():
mf = jarfile.open("META-INF/MANIFEST.MF", "r")
except (IOError, BadZipfile):
pass
if mf is None:
return None
content = mf.read()
mf.close()
return content.decode("utf-8")
评论列表
文章目录