Create an array of modules to be built to allow for flexibility to
enable or disable some modules in the future and allow for additional
modules to be added easily
---
 setup.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index ffb8e1d..449894b 100644
--- a/setup.py
+++ b/setup.py
@@ -47,6 +47,9 @@ def get_pkgconfig_data(args, mod, required=True):
 ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False)
 cflags = get_pkgconfig_data(["--cflags"], "libvirt", False)
 
+c_modules = []
+py_modules = []
+
 module = Extension('libvirtmod',
                    sources = ['libvirt-override.c', 'build/libvirt.c', 
'typewrappers.c'],
                    libraries = [ "virt" ],
@@ -56,6 +59,8 @@ if cflags != "":
 if ldflags != "":
     module.extra_link_args.append(ldflags)
 
+c_modules.append(module)
+py_modules.append("libvirt")
 
 moduleqemu = Extension('libvirtmod_qemu',
                        sources = ['libvirt-qemu-override.c', 
'build/libvirt-qemu.c', 'typewrappers.c'],
@@ -66,6 +71,9 @@ if cflags != "":
 if ldflags != "":
     moduleqemu.extra_link_args.append(ldflags)
 
+c_modules.append(moduleqemu)
+py_modules.append("libvirt_qemu")
+
 modulelxc = Extension('libvirtmod_lxc',
                       sources = ['libvirt-lxc-override.c', 
'build/libvirt-lxc.c', 'typewrappers.c'],
                       libraries = [ "virt-lxc" ],
@@ -75,6 +83,10 @@ if cflags != "":
 if ldflags != "":
     modulelxc.extra_link_args.append(ldflags)
 
+c_modules.append(modulelxc)
+py_modules.append("libvirt_lxc")
+
+
 class my_build(build):
 
     def get_api_xml_files(self):
@@ -253,8 +265,8 @@ setup(name = 'libvirt-python',
       maintainer = 'Libvirt Maintainers',
       maintainer_email = 'libvir-list@redhat.com',
       description = 'The libvirt virtualization API',
-      ext_modules = [module, modulelxc, moduleqemu],
-      py_modules = ["libvirt", "libvirt_qemu", "libvirt_lxc"],
+      ext_modules = c_modules,
+      py_modules = py_modules,
       package_dir = {
           '': 'build'
       },
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to