manifest.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:javapackages 作者: fedora-java 项目源码 文件源码
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")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号