diff --git a/ctypesgen/__main__.py b/ctypesgen/__main__.py index 5a7c3b26..40a556e4 100644 --- a/ctypesgen/__main__.py +++ b/ctypesgen/__main__.py @@ -325,7 +325,7 @@ def __call__(self, parser, namespace, values, option_string=None): args = parser.parse_args(given_argv) - if not any([args.headers, args.system_headers]): + if not (args.headers or args.system_headers): raise argparse.ArgumentError("Either --headers or --system-headers required.") if args.cpp: diff --git a/ctypesgen/ctypedescs.py b/ctypesgen/ctypedescs.py index c0682a65..0666526e 100755 --- a/ctypesgen/ctypedescs.py +++ b/ctypesgen/ctypedescs.py @@ -298,7 +298,7 @@ def __init__(self, tag, attrib, variety, members, src=None): self.attrib = attrib self.variety = variety # "struct" or "union" self.members = members - self.opaque = True if self.members is None else False + self.opaque = self.members is None self.src = src if type(self.tag) == int or not self.tag: diff --git a/ctypesgen/processor/dependencies.py b/ctypesgen/processor/dependencies.py index d0410ebf..6388c985 100755 --- a/ctypesgen/processor/dependencies.py +++ b/ctypesgen/processor/dependencies.py @@ -18,7 +18,7 @@ def find_dependencies(data, opts): typedef_names = {} ident_names = {} - # Start the lookup tables with names from imported modules + # Start the lookup tables with names from linked modules for name in opts.linked_symbols: typedef_names[name] = None @@ -155,12 +155,11 @@ def add_to_lookup_table(desc, kind): # Macros are handled differently from everything else because macros can # call other macros that are referenced after them in the input file, but # no other type of description can look ahead like that. - + + macros = [] for kind, desc in data.output_order: add_to_lookup_table(desc, kind) - if kind != "macro": - find_dependencies_for(desc, kind) + find_dependencies_for(desc, kind) if kind != "macro" else macros.append(desc) - for kind, desc in data.output_order: - if kind == "macro": - find_dependencies_for(desc, kind) + for desc in macros: + find_dependencies_for(desc, "macro") diff --git a/tests/conftest.py b/tests/conftest.py index 2dccd266..2f66a2f4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -85,9 +85,6 @@ def generate(header, args=[], lang="py", sys_header=False): assert False -# -- Functions facilitating tests of use of cross inclusion -- - - def generate_common(): common_lib = "libcommon.dll" if sys.platform == "win32" else "libcommon.so" _create_common_files()