Don't skip dbus-codegen tests on Win32

And coincidentally on Darwin either.
This commit is contained in:
John Ralls
2024-01-28 14:31:37 -08:00
parent 494f8d4d87
commit 3ef742ebee
2 changed files with 47 additions and 68 deletions

View File

@@ -24,6 +24,7 @@
import argparse
import os
import sys
from contextlib import contextmanager
from . import config
from . import dbustypes
@@ -63,6 +64,15 @@ def find_prop(iface, prop):
return None
@contextmanager
def file_or_stdout(filename):
if filename is None or filename == "stdout":
yield sys.stdout
else:
with open(filename, "w") as outfile:
yield outfile
def apply_annotation(iface_list, iface, method, signal, prop, arg, key, value):
iface_obj = None
for i in iface_list:
@@ -446,7 +456,7 @@ def codegen_main():
rst_gen.generate(rst, args.output_directory)
if args.header:
with open(h_file, "w") as outfile:
with file_or_stdout(h_file) as outfile:
gen = codegen.HeaderCodeGenerator(
all_ifaces,
args.c_namespace,
@@ -463,7 +473,7 @@ def codegen_main():
gen.generate()
if args.body:
with open(c_file, "w") as outfile:
with file_or_stdout(c_file) as outfile:
gen = codegen.CodeGenerator(
all_ifaces,
args.c_namespace,
@@ -478,7 +488,7 @@ def codegen_main():
gen.generate()
if args.interface_info_header:
with open(h_file, "w") as outfile:
with file_or_stdout(h_file) as outfile:
gen = codegen.InterfaceInfoHeaderCodeGenerator(
all_ifaces,
args.c_namespace,
@@ -493,7 +503,7 @@ def codegen_main():
gen.generate()
if args.interface_info_body:
with open(c_file, "w") as outfile:
with file_or_stdout(c_file) as outfile:
gen = codegen.InterfaceInfoBodyCodeGenerator(
all_ifaces,
args.c_namespace,