def write(self, commands, stream): p = uprint(stream) verbose = ' --verbose' if self.echo else '' jobs = ' --jobs %s' % self.jobs if self.jobs else '' p('#!%s --shebang --eta%s%s --' % (require_executable('parallel'), jobs, verbose)) for i, subcommands in enumerate(commands): p(" && ".join(subcommands + [pbar(i+1, len(commands))]))
def run(self, stream): if self.jobs: addon = ['-j', str(self.jobs)] else: addon = [] p = subprocess.Popen([require_executable('make', ['gmake', 'make']), '-f', '-'] + addon, shell=False, stdin=subprocess.PIPE) p.communicate(stream.getvalue()) return p.returncode
def write(self, commands, stream): p = uprint(stream) p('#!%s' % require_executable('sh', ['bash', 'zsh', 'dash', 'sh'])) p('set -eu') if self.echo: p('set -x') for i, subcommands in enumerate(commands): p("\n".join(subcommands)) if self.echo: p('( set +x ; %s ) 2>/dev/null' % pbar(i+1, len(commands))) else: p(pbar(i+1, len(commands))) p()