__main__.py 文件源码

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

项目:cheribuild 作者: CTSRD-CHERI 项目源码 文件源码
def updateCheck():
    from pathlib import Path
    if not shutil.which("git"):
        return
    # check if new commits are available
    projectDir = str(Path(__file__).parent)
    subprocess.call(["git", "fetch"], cwd=projectDir)
    output = subprocess.check_output(["git", "status", "-uno"], cwd=projectDir)
    behindIndex = output.find(b"Your branch is behind ")
    if behindIndex > 0:
        msgEnd = output.find(b"\n  (use \"git pull\" to update your local branch)")
        if msgEnd > 0:
            output = output[behindIndex:msgEnd]
        statusUpdate("Current CheriBuild checkout can be updated: ", output.decode("utf-8"))
        if input("Would you like to update before continuing? y/[n] (Enter to skip) ").lower().startswith("y"):
            subprocess.check_call(["git", "pull", "--rebase"], cwd=projectDir)
            os.execv(sys.argv[0], sys.argv)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号