release.py 文件源码

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

项目:LBOfficeMRU 作者: nriley 项目源码 文件源码
def archive_bundles(product_name, version, bundle_paths):
    file_paths = git('ls-files', '-z', *bundle_paths).rstrip('\0').split('\0')

    git('commit', '-am', version)

    temp_dir_path = tempfile.mkdtemp(prefix='upload_' + product_name)
    archive_dir_path = os.path.join(temp_dir_path, '%s %s' % (product_name, version), '')
    git('checkout-index', '--prefix=' + archive_dir_path, *file_paths)
    git('reset', 'HEAD~')

    for py_path in (f for f in file_paths if f.endswith('.py')):
        py_path = os.path.join(archive_dir_path, py_path)
        compileall.compile_file(py_path)
        # can't delete default.py because LaunchBar won't let me point at a .pyc
        if os.path.split(py_path)[1] != 'default.py':
            os.unlink(py_path)

    for bundle_path in bundle_paths:
        sign_bundle(os.path.join(archive_dir_path, bundle_path))

    # note: a single action can be zipped into a .lbaction file instead
    archive_path = os.path.join(project_path(), '%s-%s.zip' % (product_name, version))
    subprocess.check_call(['/usr/bin/ditto', '-ck', temp_dir_path, archive_path])
    shutil.rmtree(temp_dir_path)

    return archive_path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号