109 """Keep only the regions the line markers attribute to the module's own files.
111 Without this, a definition in an included header counts as the module's own: two C++
112 modules (iop/bilateral.cc, iop/tonemap.cc) pick up an unrelated `init(...)' from a
113 header and would claim an init() they do not have.
117 marker = re.compile(
r'^#\s+\d+\s+"([^"]*)"')
118 module_dir = os.path.realpath(module_dir)
119 for line
in preprocessed.splitlines():
120 match = marker.match(line)
121 if match
is not None:
122 name = match.group(1)
123 path = os.path.realpath(name)
if os.path.isabs(name)
else None
124 keeping = (path
is not None and path.startswith(module_dir + os.sep)) \
125 or os.path.basename(name).startswith(
"introspection_")
129 return "\n".join(kept)
254 parser = argparse.ArgumentParser(description=__doc__)
255 sub = parser.add_subparsers(dest=
"command", required=
True)
257 module_parser = sub.add_parser(
"module", help=
"presence header + so-fill source")
258 module_parser.add_argument(
"--module", required=
True)
259 module_parser.add_argument(
"--module-dir", required=
True)
260 module_parser.add_argument(
"--api", required=
True)
261 module_parser.add_argument(
"--present", required=
True)
262 module_parser.add_argument(
"--fill", required=
True)
267 module_parser.add_argument(
"--cc", required=
True)
268 module_parser.add_argument(
"--cxx", required=
True)
269 module_parser.add_argument(
"--sources", nargs=
"+", required=
True)
271 registry_parser = sub.add_parser(
"registry", help=
"the table of every built module")
272 registry_parser.add_argument(
"--out", required=
True)
273 registry_parser.add_argument(
"--modules", nargs=
"+", required=
True)
280 cut = argv.index(
"--")
281 argv, flags = argv[:cut], argv[cut + 1:]
283 args = parser.parse_args(argv)
286 if args.command ==
"registry":
291 api_names = {name
for _kind, name
in args.api} | set(VERSION_FUNCTIONS)