stamp.py 文件源码

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

项目:GAMADV-XTD 作者: taers232c 项目源码 文件源码
def stamp_source(base_dir, version, dry_run=False):
    """update version string in passlib dist"""
    path = os.path.join(base_dir, "passlib", "__init__.py")
    with open(path) as fh:
        input = fh.read()
    output, count = re.subn('(?m)^__version__\s*=.*$',
                    '__version__ = ' + repr(version),
                    input)
    assert count == 1, "failed to replace version string"
    if not dry_run:
        os.unlink(path) # sdist likes to use hardlinks
        with open(path, "w") as fh:
            fh.write(output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号