test_install_script.py 文件源码

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

项目:yt 作者: yt-project 项目源码 文件源码
def run_install_script(install_script_path, inst_py3, binary_yt=False):
    msg = 'Testing installation with inst_py3={} and binary_yt={}'
    print (msg.format(inst_py3, binary_yt))
    shutil.copy(install_script_path, os.curdir)
    with open('install_script.sh', 'r') as source:
        with open('install_script_edited.sh', 'w') as target:
            data = source.read()
            for dep in OPTIONAL_DEPS:
                if binary_yt is True and dep in YT_SOURCE_ONLY_DEPS:
                    continue
                if dep == 'rockstar':
                    # compiling rockstar is broken on newer MacOS releases
                    if platform.mac_ver()[0].startswith(('10.12', '10.13')):
                        continue
                dname = 'INST_%s' % dep.upper()
                data = data.replace(dname + '=0', dname + '=1')
            if inst_py3 is True:
                data = data.replace('INST_PY3=0', 'INST_PY3=1')
            if binary_yt is False:
                data = data.replace('INST_YT_SOURCE=0', 'INST_YT_SOURCE=1')
            target.write(data)
    shutil.copyfile('install_script_edited.sh', 'install_script.sh')
    call_unix_command('bash install_script.sh --yes')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号