def command(ctx, make_cmd, make_args): """Generates compilation database file for an arbitrary GNU Make command. Acts like a make wrapper, forwarding all MAKE_ARGS to make command""" make_cmd = make_cmd or 'make' logging_mode_flags = "-Bnkw" options = ctx.obj if not options.no_build: cmd = [make_cmd] + list(make_args) print("## Building [{}]...".format(' '.join(cmd))) ret = call(cmd, stdout=stdout, stderr=stderr) print() if ret != 0: exit(1) done = False args = vars(options) del args['no_build'] with AutoconfMockScript(options.verbose) as mock_script: cmd = [make_cmd, logging_mode_flags] + list(make_args) if mock_script.path: cmd.append("SHELL={}".format(mock_script.path)) pipe = popen(cmd, stdout=PIPE) options.infile = pipe.stdout del args['verbose'] done = generate(**args) pipe.wait() exit(0 if done else 1)
def assert_generate_is_true(outstream, overwrite): with input_file('multiple_commands_oneline.txt') as instream: assert generate(infile=instream, outfile=outstream, build_dir=os.getcwd(), exclude_files=[], overwrite=overwrite, strict=False)
def command(ctx, make_cmd, make_args): """Generates compilation database file for an arbitrary GNU Make command. Acts like a make wrapper, forwarding all MAKE_ARGS to make command""" make_cmd = make_cmd or 'make' logging_mode_flags = "-Bnkw" options = ctx.obj if not options.no_build: cmd = [make_cmd] + list(make_args) print("## Building [{}]...".format(' '.join(cmd))) ret = call(cmd, stdout=stdout, stderr=stderr) print() if ret != 0: exit(1) cmd = [make_cmd, logging_mode_flags] + list(make_args) pipe = popen(cmd, stdout=PIPE, encoding='utf-8') options.infile = pipe.stdout generate(**vars(options)) pipe.wait()