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))
评论列表
文章目录