mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-17 00:59:36 +03:00
setup.py: Make have_libvirt_lxc a function
This means we call it twice for a build operation, but I don't think that's a big deal.
This commit is contained in:
19
setup.py
19
setup.py
@ -34,13 +34,14 @@ spawn([pkgcfg,
|
|||||||
"--atleast-version=%s" % MIN_LIBVIRT,
|
"--atleast-version=%s" % MIN_LIBVIRT,
|
||||||
"libvirt"])
|
"libvirt"])
|
||||||
|
|
||||||
have_libvirt_lxc=True
|
def have_libvirt_lxc():
|
||||||
try:
|
try:
|
||||||
spawn([pkgcfg,
|
spawn([pkgcfg,
|
||||||
"--atleast-version=%s" % MIN_LIBVIRT_LXC,
|
"--atleast-version=%s" % MIN_LIBVIRT_LXC,
|
||||||
"libvirt"])
|
"libvirt"])
|
||||||
except DistutilsExecError:
|
return True
|
||||||
have_libvirt_lxc=False
|
except DistutilsExecError:
|
||||||
|
return False
|
||||||
|
|
||||||
def get_pkgconfig_data(args, mod, required=True):
|
def get_pkgconfig_data(args, mod, required=True):
|
||||||
"""Run pkg-config to and return content associated with it"""
|
"""Run pkg-config to and return content associated with it"""
|
||||||
@ -106,7 +107,7 @@ def get_module_lists():
|
|||||||
c_modules.append(moduleqemu)
|
c_modules.append(moduleqemu)
|
||||||
py_modules.append("libvirt_qemu")
|
py_modules.append("libvirt_qemu")
|
||||||
|
|
||||||
if have_libvirt_lxc:
|
if have_libvirt_lxc():
|
||||||
modulelxc = Extension('libvirtmod_lxc',
|
modulelxc = Extension('libvirtmod_lxc',
|
||||||
sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'],
|
sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'],
|
||||||
libraries = [ "virt-lxc" ],
|
libraries = [ "virt-lxc" ],
|
||||||
@ -133,7 +134,7 @@ class my_build(build):
|
|||||||
|
|
||||||
self.spawn([sys.executable, "generator.py", "libvirt", apis[0]])
|
self.spawn([sys.executable, "generator.py", "libvirt", apis[0]])
|
||||||
self.spawn([sys.executable, "generator.py", "libvirt-qemu", apis[1]])
|
self.spawn([sys.executable, "generator.py", "libvirt-qemu", apis[1]])
|
||||||
if have_libvirt_lxc:
|
if have_libvirt_lxc():
|
||||||
self.spawn([sys.executable, "generator.py", "libvirt-lxc", apis[2]])
|
self.spawn([sys.executable, "generator.py", "libvirt-lxc", apis[2]])
|
||||||
|
|
||||||
build.run(self)
|
build.run(self)
|
||||||
|
Reference in New Issue
Block a user