当前位置: 首页>>代码示例>>Python>>正文


Python BuildPack._release方法代码示例

本文整理汇总了Python中build_pack_utils.BuildPack._release方法的典型用法代码示例。如果您正苦于以下问题:Python BuildPack._release方法的具体用法?Python BuildPack._release怎么用?Python BuildPack._release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在build_pack_utils.BuildPack的用法示例。


在下文中一共展示了BuildPack._release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compile

# 需要导入模块: from build_pack_utils import BuildPack [as 别名]
# 或者: from build_pack_utils.BuildPack import _release [as 别名]
def compile(install):
    ctx = install.builder._ctx
    # setup logs director for bp
    os.makedirs(os.path.join(ctx['BUILD_DIR'], 'logs'))
    # read links file
    with open(os.path.join(ctx['BUILD_DIR'], 'download-list.txt')) as fp:
        links = [line.strip() for line in fp.readlines()]
    log.info("Loaded %d downloads.", len(links))
    # download links
    for link in links:
        log.debug("Preparing to download [%s]", link)
        if link.startswith('http'):
            download(install, link)
        else:
            print 'Not sure how to handle [%s], skipping.' % link
    log.info("All downloads complete.")
    # read build pack
    with open(os.path.join(ctx['BUILD_DIR'], 'build-pack.txt')) as fp:
        bp_link = fp.read().strip()
    log.info("Running build pack [%s]", bp_link)
    if bp_link.find('#') >= 0:
        (bp_link, bp_ver) = bp_link.split('#')
        bp = BuildPack(ctx, bp_link, bp_ver)
    else:
        bp = BuildPack(ctx, bp_link)
    # run build pack
    log.info("Cloning build pack")
    bp._clone()
    log.info("Compiling build pack")
    bp._compile()
    # save output from release
    log.info("Running release script")
    release_path = os.path.join(tempfile.gettempdir(), 'release.out')
    with open(release_path, 'wt') as fp:
        result = bp._release()
        log.debug("Build pack release returned [%s]", result)
        fp.write(result)
    log.debug("Compile done.")
    return 0
开发者ID:dmikusa-pivotal,项目名称:cf-download-build-pack,代码行数:41,代码来源:extension.py


注:本文中的build_pack_utils.BuildPack._release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。