MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / build_commands

Function build_commands

scripts/memwaste-padding.py:44–80  ·  view source on GitHub ↗
(cc: str, cxx: str)

Source from the content-addressed store, hash-verified

42
43
44def build_commands(cc: str, cxx: str) -> list[tuple[str, list[str], str]]:
45 dry = subprocess.run(["make", "-f", "Makefile.cbm", "-n", "cbm", "BUILD_DIR=build/memwaste-padding-dry",
46 f"CC={cc}", f"CXX={cxx}", "MEMWASTE=1"],
47 cwd=ROOT, capture_output=True, text=True, check=False)
48 text = dry.stdout.replace("\\\n", " ")
49 jobs = []
50 seen = set()
51 for line in text.splitlines():
52 try:
53 argv = shlex.split(line)
54 except ValueError:
55 continue
56 if not argv or os.path.basename(argv[0]) not in (cc, cxx, os.path.basename(cc), os.path.basename(cxx)):
57 continue
58 flags = []
59 sources = []
60 i = 1
61 while i < len(argv):
62 a = argv[i]
63 if a in KEEP_WITH_ARG and i + 1 < len(argv):
64 flags += [a, argv[i + 1]]
65 i += 2
66 continue
67 if a == "-o":
68 i += 2
69 continue
70 if a.startswith(("-I", "-D", "-U", "-std=")):
71 flags.append(a)
72 elif a.endswith(SRC_EXT) and os.path.isfile(os.path.join(ROOT, a)):
73 sources.append(a)
74 i += 1
75 for s in sources:
76 key = (s, tuple(flags))
77 if key not in seen:
78 seen.add(key)
79 jobs.append((argv[0], flags, s))
80 return jobs
81
82
83def run_one(job: tuple[str, list[str], str]) -> tuple[str, str]:

Callers 1

mainFunction · 0.85

Calls 2

setFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected