dbus-exporter: apply "ruff format" and "ruff check --fix"
This commit is contained in:
+16
-8
@@ -11,14 +11,15 @@ def extract_interfaces_xml(output_dir, executable):
|
|||||||
# as glibc looks at /proc/self/exe when resolving RPATH
|
# as glibc looks at /proc/self/exe when resolving RPATH
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if not os.path.exists('/proc/self'):
|
if not os.path.exists('/proc/self'):
|
||||||
env["LD_ORIGIN_PATH"] = executable.parent.as_posix()
|
env['LD_ORIGIN_PATH'] = executable.parent.as_posix()
|
||||||
|
|
||||||
proc = run(
|
proc = run(
|
||||||
args=[executable.absolute(), '--bus-introspect', 'list'],
|
args=[executable.absolute(), '--bus-introspect', 'list'],
|
||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
env=env,
|
env=env,
|
||||||
check=True,
|
check=True,
|
||||||
universal_newlines=True)
|
text=True,
|
||||||
|
)
|
||||||
|
|
||||||
interface_names = (x.split()[1] for x in proc.stdout.splitlines())
|
interface_names = (x.split()[1] for x in proc.stdout.splitlines())
|
||||||
|
|
||||||
@@ -28,19 +29,25 @@ def extract_interfaces_xml(output_dir, executable):
|
|||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
env=env,
|
env=env,
|
||||||
check=True,
|
check=True,
|
||||||
universal_newlines=True)
|
text=True,
|
||||||
|
)
|
||||||
|
|
||||||
interface_file_name = output_dir / (interface_name + '.xml')
|
interface_file_name = output_dir / (interface_name + '.xml')
|
||||||
interface_file_name.write_text(proc.stdout)
|
interface_file_name.write_text(proc.stdout)
|
||||||
interface_file_name.chmod(0o644)
|
interface_file_name.chmod(0o644)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument('output',
|
parser.add_argument(
|
||||||
type=Path)
|
'output',
|
||||||
parser.add_argument('executables',
|
type=Path,
|
||||||
nargs='+',
|
)
|
||||||
type=Path)
|
parser.add_argument(
|
||||||
|
'executables',
|
||||||
|
nargs='+',
|
||||||
|
type=Path,
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@@ -50,5 +57,6 @@ def main():
|
|||||||
for exe in args.executables:
|
for exe in args.executables:
|
||||||
extract_interfaces_xml(args.output, exe)
|
extract_interfaces_xml(args.output, exe)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user