The functions that the LXC module wraps did not appear until 1.0.2 so we can't build the module unless we're building against 1.0.2 or newer. --- setup.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 449894b..059a772 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ from distutils.command.sdist import sdist from distutils.dir_util import remove_tree from distutils.util import get_platform from distutils.spawn import spawn +from distutils.errors import DistutilsExecError import distutils import sys @@ -17,6 +18,7 @@ import re import time MIN_LIBVIRT = "0.10.2" +MIN_LIBVIRT_LXC = "1.0.2" pkgcfg = distutils.spawn.find_executable("pkg-config") @@ -28,6 +30,14 @@ spawn([pkgcfg, "--atleast-version=%s" % MIN_LIBVIRT, "libvirt"]) +have_libvirt_lxc=True +try: + spawn([pkgcfg, + "--atleast-version=%s" % MIN_LIBVIRT_LXC, + "libvirt"]) +except DistutilsExecError,e: + have_libvirt_lxc=False + def get_pkgconfig_data(args, mod, required=True): """Run pkg-config to and return content associated with it""" f = os.popen("%s %s %s" % (pkgcfg, " ".join(args), mod)) @@ -74,17 +84,18 @@ if 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" ], - include_dirs = [ "." ]) -if cflags != "": - modulelxc.extra_compile_args.append(cflags) -if ldflags != "": - modulelxc.extra_link_args.append(ldflags) +if have_libvirt_lxc: + modulelxc = Extension('libvirtmod_lxc', + sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c'], + libraries = [ "virt-lxc" ], + include_dirs = [ "." ]) + if cflags != "": + modulelxc.extra_compile_args.append(cflags) + if ldflags != "": + modulelxc.extra_link_args.append(ldflags) -c_modules.append(modulelxc) -py_modules.append("libvirt_lxc") + c_modules.append(modulelxc) + py_modules.append("libvirt_lxc") class my_build(build): @@ -109,7 +120,8 @@ class my_build(build): self.spawn(["./generator.py", "libvirt", apis[0]]) self.spawn(["./generator.py", "libvirt-qemu", apis[1]]) - self.spawn(["./generator.py", "libvirt-lxc", apis[2]]) + if have_libvirt_lxc: + self.spawn(["./generator.py", "libvirt-lxc", apis[2]]) build.run(self) -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list