From e43eb1177872f52e949fb5f0f93396ed94b0d093 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 2 Aug 2026 14:48:29 +0200 Subject: move to chezmoi --- .../dot_local/share/bin/executable_sdk10_compiledb | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 home/dot_local/share/bin/executable_sdk10_compiledb (limited to 'home/dot_local/share/bin/executable_sdk10_compiledb') diff --git a/home/dot_local/share/bin/executable_sdk10_compiledb b/home/dot_local/share/bin/executable_sdk10_compiledb new file mode 100644 index 0000000..6e62d47 --- /dev/null +++ b/home/dot_local/share/bin/executable_sdk10_compiledb @@ -0,0 +1,38 @@ +#!/bin/python3 + +from shlex import split, join +from sys import argv +from os import getcwd +import subprocess + +process = subprocess.run(argv[1:], stdout=subprocess.PIPE, stderr=None, env={"LANG": "C"}) + +dir_stack = [getcwd()] +expanded_output = [] + +for line in process.stdout.decode('utf-8').split('\n'): + expanded_args = [] + args = split(line) + + if line.startswith('make: Entering directory'): + dir_stack.append(args[-1]) + expanded_output.append(line) + continue + if line.startswith('make: Leaving directory'): + dir_stack.pop() + expanded_output.append(line) + continue + + for arg in args: + if not arg.startswith('@'): + expanded_args.append(arg) + continue + with open(dir_stack[-1] + '/' + arg[1:], 'r') as file: + expanded_args += split(file.read()) + expanded_output.append(subprocess.list2cmdline(expanded_args)) + +process = subprocess.Popen(["compiledb"], stdin=subprocess.PIPE, stdout=None, stderr=None, text=True) +process.stdin.write("\n".join(expanded_output)) +process.stdin.close() +process.wait() + -- cgit v1.2.3