From 7009525a64ba3e8b9bd634c48b74e369dc7c9344 Mon Sep 17 00:00:00 2001 From: Xeeynamo Date: Tue, 19 Sep 2023 22:25:08 +0000 Subject: [PATCH] Format code --- tools/m2ctx.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 03880188f..113b3067d 100644 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -25,24 +25,29 @@ CPP_FLAGS = [ "-DM2CTX", ] + def import_c_file(in_file) -> str: in_file = os.path.relpath(in_file, root_dir) cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file] cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, in_file] with tempfile.NamedTemporaryFile(suffix=".c") as tmp: - stock_macros = subprocess.check_output(["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8") + stock_macros = subprocess.check_output( + ["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8" + ) out_text = "" try: out_text += subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8") - out_text += subprocess.check_output(cpp_command2, cwd=root_dir, encoding="utf-8") + out_text += subprocess.check_output( + cpp_command2, cwd=root_dir, encoding="utf-8" + ) except subprocess.CalledProcessError: print( "Failed to preprocess input file, when running command:\n" - + ' '.join(cpp_command), + + " ".join(cpp_command), file=sys.stderr, - ) + ) sys.exit(1) if not out_text: @@ -53,6 +58,7 @@ def import_c_file(in_file) -> str: out_text = out_text.replace(line + "\n", "") return out_text + def main(): parser = argparse.ArgumentParser( description="""Create a context file which can be used for m2c / decomp.me"""