[libvirt] [libvirt-python PATCH] setup: Make libvirt API XML path configurable

Daniel P. Berrange berrange at redhat.com
Tue Nov 26 10:14:36 UTC 2013


On Tue, Nov 26, 2013 at 10:58:25AM +0100, Martin Kletzander wrote:
> Adding a support for LIBVIRT_API_PATH evironment variable, which can
> control where the script should look for the 'libvirt-api.xml' file.
> This allows building libvirt-python against different libvirt than the
> one installed in the system.  This may be used for example in autotest
> or by packagers without the need to install libvirt into the system.
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  setup.py | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/setup.py b/setup.py
> index 17b4722..566c210 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -109,7 +109,17 @@ class my_build(build):
>          """Check with pkg-config that libvirt is present and extract
>          the API XML file paths we need from it"""
> 
> -        libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], "libvirt")
> +        libvirt_api = os.getenv("LIBVIRT_API_PATH")
> +
> +        if libvirt_api:
> +            if not libvirt_api.endswith("-api.xml"):
> +                raise ValueError("Invalid path '%s' for API XML" % libvirt_api)
> +            if not os.path.exists(libvirt_api):
> +                raise ValueError("API XML '%s' does not exist, "
> +                                 "have you built libvirt?" % libvirt_api)
> +        else:
> +            libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"],
> +                                             "libvirt")
> 
>          offset = libvirt_api.index("-api.xml")
>          libvirt_qemu_api = libvirt_api[0:offset] + "-qemu-api.xml"

NACK, setting pkg-config already takes care of this. See the
build-many.sh scrpit attached to this mail which demonstrates
use of PKG_CONFIG_PATH to build against every version of libvirt
back to 0.9.11

https://www.redhat.com/archives/libvir-list/2013-November/msg00933.html

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list