easy_annotate.py 文件源码

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

项目:easy_update 作者: fizwit 项目源码 文件源码
def parse_eb(file_path):
        # type: (object) -> object file_name) -> dict:
        """ interpret easyconfig file with 'exec'.  Interperting fails if
            undefined constants are within the Easyconfig file.
            Add undefined constants to <header>.
        """
        header = 'SOURCE_TGZ  = "%(name)s-%(version)s.tgz"\n'
        header += 'SOURCE_TAR_GZ = "%(name)s-%(version)s.tar.gz"\n'
        code = header

        eb = imp.new_module("easyconfig")
        with open(file_path, "r") as f:
            code += f.read()
        try:
            exec (code, eb.__dict__)
        except Exception, e:
            print("interperting easyconfig error: %s" % e)
            eb = {}
        return eb
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号