def execute_distutils(project, logger, distutils_commands, clean=False): reports_dir = _prepare_reports_dir(project) setup_script = project.expand_path("$dir_dist", "setup.py") for command in distutils_commands: logger.debug("Executing distutils command %s", command) if is_string(command): out_file = os.path.join(reports_dir, safe_log_file_name(command)) else: out_file = os.path.join(reports_dir, safe_log_file_name("__".join(command))) with open(out_file, "w") as out_f: commands = [sys.executable, setup_script] if project.get_property("verbose"): commands.append("-v") if clean: commands.extend(["clean", "--all"]) if is_string(command): commands.extend(command.split()) else: commands.extend(command) return_code = _run_process_and_wait(commands, project.expand_path("$dir_dist"), out_f) if return_code != 0: raise BuildFailedException( "Error while executing setup command %s. See %s for full details:\n%s", command, out_file, tail_log(out_file))
def execute_distutils(project, logger, distutils_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 distutils_commands: logger.debug("Executing distutils command %s", command) if is_string(command): output_file_path = os.path.join(reports_dir, command.replace("/", "")) else: output_file_path = os.path.join(reports_dir, "__".join(command).replace("/", "")) with open(output_file_path, "w") as output_file: commands = [sys.executable, setup_script] if project.get_property("verbose"): commands.append("-v") if is_string(command): commands.extend(command.split()) else: commands.extend(command) process = subprocess.Popen(commands, cwd=project.expand_path("$dir_dist"), 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))
def execute_distutils(project, logger, distutils_commands, clean=False): 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 distutils_commands: logger.debug("Executing distutils command %s", command) if is_string(command): output_file_path = os.path.join(reports_dir, command.replace("/", "")) else: output_file_path = os.path.join( reports_dir, "__".join(command).replace("/", "")) with open(output_file_path, "w") as output_file: commands = [sys.executable, setup_script] if project.get_property("verbose"): commands.append("-v") if clean: commands.extend(["clean", "--all"]) if is_string(command): commands.extend(command.split()) else: commands.extend(command) return_code = _run_process_and_wait( commands, project.expand_path("$dir_dist"), output_file) if return_code != 0: raise BuildFailedException( "Error while executing setup command %s, see %s for details" % (command, output_file_path))
def execute_distutils(project, logger, distutils_commands, clean=False): reports_dir = _prepare_reports_dir(project) setup_script = project.expand_path("$dir_dist", "setup.py") for command in distutils_commands: logger.debug("Executing distutils command %s", command) if is_string(command): output_file_path = os.path.join(reports_dir, command.replace("/", "")) else: output_file_path = os.path.join(reports_dir, "__".join(command).replace("/", "")) with open(output_file_path, "w") as output_file: commands = [sys.executable, setup_script] if project.get_property("verbose"): commands.append("-v") if clean: commands.extend(["clean", "--all"]) if is_string(command): commands.extend(command.split()) else: commands.extend(command) return_code = _run_process_and_wait(commands, project.expand_path("$dir_dist"), output_file) if return_code != 0: raise BuildFailedException( "Error while executing setup command {0!s}, see {1!s} for details".format(command, output_file_path))