aboutsummaryrefslogtreecommitdiff
path: root/home/dot_local/share/bin/executable_sdk10_compiledb
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
commite43eb1177872f52e949fb5f0f93396ed94b0d093 (patch)
tree78b73af6a989fa2996d71b112e161b70d35081ef /home/dot_local/share/bin/executable_sdk10_compiledb
parent2f14a896e4b897bd747c24d7ad8e9e7bb3237d03 (diff)
move to chezmoi
Diffstat (limited to 'home/dot_local/share/bin/executable_sdk10_compiledb')
-rw-r--r--home/dot_local/share/bin/executable_sdk10_compiledb38
1 files changed, 38 insertions, 0 deletions
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()
+