mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
![igo95862](/assets/img/avatar_default.png)
Pass -Ddbus-interfaces-dir=no to meson to disable export Interfaces from: org.freedesktop.home1 org.freedesktop.hostname1 org.freedesktop.import1 org.freedesktop.locale1 org.freedesktop.LogControl1 org.freedesktop.login1 org.freedesktop.machine1 org.freedesktop.oom1 org.freedesktop.portable1 org.freedesktop.resolve1 org.freedesktop.systemd1 org.freedesktop.timedate1
62 lines
1.5 KiB
Python
Executable file
62 lines
1.5 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
from argparse import ArgumentParser
|
|
from pathlib import Path
|
|
from subprocess import run, PIPE
|
|
|
|
|
|
def extract_interfaces_xml(output_dir, executable):
|
|
list_interfaces_process = run(
|
|
args=[executable.absolute(), '--bus-introspect', 'list'],
|
|
stdout=PIPE,
|
|
check=True,
|
|
universal_newlines=True,
|
|
)
|
|
|
|
interfaces_lines = list_interfaces_process.stdout.splitlines()
|
|
|
|
interface_names = [x.split()[1] for x in interfaces_lines]
|
|
|
|
for interface_name in interface_names:
|
|
interface_introspection_run = run(
|
|
args=[executable.absolute(), '--bus-introspect', interface_name],
|
|
stdout=PIPE,
|
|
check=True,
|
|
universal_newlines=True,
|
|
)
|
|
|
|
interface_file_name = output_dir / (interface_name + '.xml')
|
|
with open(interface_file_name, mode='w') as f:
|
|
f.write(interface_introspection_run.stdout)
|
|
interface_file_name.chmod(0o644)
|
|
|
|
|
|
def iterate_executables(output_dir, executables):
|
|
output_dir.mkdir(mode=0o755, exist_ok=True)
|
|
|
|
for exe in executables:
|
|
extract_interfaces_xml(output_dir, exe)
|
|
|
|
|
|
def main():
|
|
parser = ArgumentParser()
|
|
|
|
parser.add_argument(
|
|
'output',
|
|
type=Path,
|
|
)
|
|
|
|
parser.add_argument(
|
|
'executables',
|
|
type=Path,
|
|
nargs='+',
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
iterate_executables(args.output, args.executables)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|