__init__.py 文件源码

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

项目:build-calibre 作者: kovidgoyal 项目源码 文件源码
def copy_crt(env):
    printf('Copying CRT...')
    plat = ('x64' if is64bit else 'x86')
    vc_path = os.path.join(r'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist', plat, 'Microsoft.VC140.CRT')
    if not os.path.exists(vc_path):
        raise SystemExit('Visual Studio redistributable CRT not found at: %r' % vc_path)
    # We cannot use the Universal CRT DLLs that come with Visual Studio, as
    # they are broken. Have to use the ones from the Standalone SDK for Windows 10.
    # However, I dont want to install this SDK, incase it messes things up,
    # so the below path points to dlls I got from installing the SDK in a
    # different VM. To re-create just copy the api-ms*.dll and ucrtbase.dll
    # files from a previous calibre install.
    sdk_path = os.path.join('C:\\ucrt', plat)
    if not os.path.exists(sdk_path):
        raise SystemExit('Windows 10 Universal CRT redistributable not found at: %r' % sdk_path)
    for dll in glob.glob(os.path.join(sdk_path, '*.dll')):
        shutil.copy2(dll, env.dll_dir)
        os.chmod(os.path.join(env.dll_dir, b(dll)), stat.S_IRWXU)
    for dll in glob.glob(os.path.join(vc_path, '*.dll')):
        bname = os.path.basename(dll)
        if not bname.startswith('vccorlib') and not bname.startswith('concrt'):
            # Those two DLLs are not required vccorlib is for the CORE CLR
            # I think concrt is the concurrency runtime for C++ which I believe
            # nothing in calibre currently uses
            shutil.copy(dll, env.dll_dir)
            os.chmod(os.path.join(env.dll_dir, bname), stat.S_IRWXU)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号