dist_utils.py 文件源码

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

项目:st2-auth-backend-oauth2 作者: pidah 项目源码 文件源码
def parse_version_string(file_path):
    """
    Parse __version__ = 'xxx' from the specifed file
    """
    version = None
    with open(file_path, 'r') as fd:
        match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
                          fd.read(), re.MULTILINE)
    if match:
        version = match.group(1)
    else:
        raise Exception('File %s doesn\'t contain __version__ = \'x.y.z\' string')

    return version
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号