summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorWojtek Porczyk <woju@invisiblethingslab.com>2017-03-17 14:35:53 +0100
committerDaniel P. Berrange <berrange@redhat.com>2017-04-04 15:28:50 +0100
commite9850106744e70b890e5fdfec9b1b5fd2c7a6ac5 (patch)
tree10ff291960cbc72a64330d2dd0b1fb25d0aa034e /setup.py
parent72e237f7b9a8c8b353753a7e9c0a6fdbb3d553c5 (diff)
downloadlibvirt-python-e9850106744e70b890e5fdfec9b1b5fd2c7a6ac5.tar.gz
Add asyncio event loop implementation
This is usable only on python >= 3.4 (or 3.3 with out-of-tree asyncio), however it should be harmless for anyone with older python versions. In simplest case, to have the callbacks queued on the default loop: >>> import libvirtaio >>> libvirtaio.virEventRegisterAsyncIOImpl() The function is not present on non-compatible platforms. Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 71998e2..c95170c 100755
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,7 @@ import sys
import os
import os.path
import re
+import shutil
import time
MIN_LIBVIRT = "0.9.11"
@@ -50,6 +51,12 @@ def have_libvirt_lxc():
except DistutilsExecError:
return False
+def have_libvirtaio():
+ # This depends on asyncio, which in turn depends on "yield from" syntax.
+ # The asyncio module itself is in standard library since 3.4, but there is
+ # an out-of-tree version compatible with 3.3.
+ return sys.version_info >= (3, 3)
+
def get_pkgconfig_data(args, mod, required=True):
"""Run pkg-config to and return content associated with it"""
f = os.popen("%s %s %s" % (get_pkgcfg(), " ".join(args), mod))
@@ -124,6 +131,9 @@ def get_module_lists():
c_modules.append(modulelxc)
py_modules.append("libvirt_lxc")
+ if have_libvirtaio():
+ py_modules.append("libvirtaio")
+
return c_modules, py_modules
@@ -141,6 +151,8 @@ class my_build(build):
self.spawn([sys.executable, "generator.py", "libvirt-qemu", apis[1]])
if have_libvirt_lxc():
self.spawn([sys.executable, "generator.py", "libvirt-lxc", apis[2]])
+ if have_libvirtaio():
+ shutil.copy('libvirtaio.py', 'build')
build.run(self)