Commit 75666e2d authored by Doug Goldstein's avatar Doug Goldstein Committed by Daniel P. Berrange

Don't build LXC module when building less than 1.0.2

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.
parent 766f7433
......@@ -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"
# Hack to stop 'pip install' failing with error
# about missing 'build' dir.
......@@ -33,6 +35,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))
......@@ -79,17 +89,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', 'libvirt-utils.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', 'libvirt-utils.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):
......@@ -114,7 +125,8 @@ class my_build(build):
self.spawn(["python", "generator.py", "libvirt", apis[0]])
self.spawn(["python", "generator.py", "libvirt-qemu", apis[1]])
self.spawn(["python", "generator.py", "libvirt-lxc", apis[2]])
if have_libvirt_lxc:
self.spawn(["python", "generator.py", "libvirt-lxc", apis[2]])
build.run(self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment