distribute.py 文件源码

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

项目:shift-detect 作者: paolodedios 项目源码 文件源码
def run_setup_commands(project, logger, commands) :
    reports_dir = project.expand_path("$dir_reports/distutils")
    if not os.path.exists(reports_dir) :
        os.mkdir(reports_dir)

    setup_script = project.expand_path("$dir_dist/setup.py")

    for command in commands :
        logger.debug("Executing distutils command %s", command)

        output_file_path = os.path.join(reports_dir, command.replace("/", ""))

        with open(output_file_path, "w") as output_file :
            commandexec = [sys.executable, setup_script]
            commandexec.extend(command.split())
            working_dir = project.expand_path("$dir_dist")
            process     = subprocess.Popen(commandexec, cwd=working_dir, stdout=output_file, stderr=output_file, shell=False)
            return_code = process.wait()
            if return_code != 0 :
                raise BuildFailedException("Error while executing setup command %s, see %s for details" % (command, output_file_path))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号