diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2022-03-24 16:58:15 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2022-04-21 12:32:51 +0100 |
commit | 2fb2e541364d07f09b1c1c8e58cc891b5b16a3b7 (patch) | |
tree | 1e4424219a60f8674fdc5a85d60a78f1170891e6 /generator.py | |
parent | 3950e1ddd5eb1040847fa0809c8ea4e2acd4967e (diff) | |
download | libvirt-python-2fb2e541364d07f09b1c1c8e58cc891b5b16a3b7.tar.gz |
generator: split loading of APIs out from writing stubs
The buildStubs method has a side effect of loading and parsing the API
XML files, which the buildWrappers method then relies on.
Splitting API loading into a separate method will facilitate running
only the buildWrappers method in future.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'generator.py')
-rwxr-xr-x | generator.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/generator.py b/generator.py index 64a884e..10f82f8 100755 --- a/generator.py +++ b/generator.py @@ -751,11 +751,9 @@ def print_c_pointer(classname: str, output: IO[str], export: IO[str], include: I (classname, classname)) -def buildStubs(module: str, api_xml: str) -> int: +def load_apis(module: str, api_xml: str): global onlyOverrides - package = module.replace('-', '_') - try: onlyOverrides = False with open(api_xml) as stream: @@ -782,6 +780,11 @@ def buildStubs(module: str, api_xml: str) -> int: # XXX: This is not right, same function already in @functions # will be overwritten. print("Found %d functions in %s" % (len(functions) - n, override_api_xml)) + + +def buildStubs(module: str) -> int: + package = module.replace('-', '_') + nb_wrap = 0 failed = 0 skipped = 0 @@ -1712,11 +1715,13 @@ if sys.argv[1] not in ["libvirt", "libvirt-lxc", "libvirt-qemu"]: print("ERROR: unknown module %s" % sys.argv[1]) sys.exit(1) +load_apis(sys.argv[1], sys.argv[2]) + quiet = False if not os.path.exists("build"): os.mkdir("build") -if buildStubs(sys.argv[1], sys.argv[2]) < 0: +if buildStubs(sys.argv[1]) < 0: sys.exit(1) buildWrappers(sys.argv[1]) |