[RFCv2 02/46] maint: Check python3-clang

Daniel P. Berrangé berrange at redhat.com
Fri Dec 4 13:01:29 UTC 2020


On Fri, Sep 04, 2020 at 11:34:54AM +0800, Shi Lei wrote:
> Make sure python3-clang has been installed.
> 
> Signed-off-by: Shi Lei <shi_lei at massclouds.com>
> ---
>  meson.build | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 1eadea3..f97a03b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2504,3 +2504,8 @@ if conf.has('WITH_QEMU')
>    }
>    summary(priv_summary, section: 'Privileges')
>  endif
> +
> +py3_clang = run_command('python3', '-c', 'import clang.cindex;print("ok")')
> +if py3_clang.returncode() != 0
> +  error('python3-clang is required.')
> +endif

This probably needs to be a bit of a stronger check, as I found it is
possible "pip install clang", without having libclang.so actually
installed, and this "import clang.cindex" will still succeeed.

I think we need to add something like

 py3_clang_working = run_command('python3', '-c', 'import clang.cindex;cindex.Index()')
 if py3_clang_working.returncode() != 0
   error('python3-clang is present, but not working. Perhaps libclang is missing?')
 endif


Also, we need to add  python3-clang to the  libvirt.spec.in and the
mingw-libvirt.spec.in, and also the containers in ci/containers/

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list