[Libguestfs] python 3 bindings on libguestfs

abinaya.manikandan at wipro.com abinaya.manikandan at wipro.com
Thu Jan 25 13:31:09 UTC 2018


Hi,

We are trying to build libguestfs RPM package using SPEC file.
As we discussed earlier to enable python bindings on libguestfs need to use ./run python but this cannot be add in SPEC file.

What we have done to enable python3 in libguestfs is below:

1. We have installed python-3.6.1
2. Enable python using --enable-python in %build section like below
"%configure --disable-appliance --disable-daemon --without-libvirt --with-qemu="qemu-kvm qemu-system-x86_64 qemu" --prefix=%{_prefix} --enable-python"
3. Now we could see below files when we installed libguestfs-1.32.10

[root at euca-172-31-15-221 1.32.10]$ ls *
bin:
guestfish             virt-copy-in    virt-diff         virt-index-validate  virt-rescue    virt-tar-out
libguestfs-test-tool  virt-copy-out   virt-edit         virt-inspector       virt-resize    virt-v2v
virt-alignment-scan   virt-customize  virt-filesystems  virt-log             virt-sparsify  virt-v2v-copy-to-local
virt-builder          virt-df         virt-format       virt-ls              virt-sysprep
virt-cat              virt-dib        virt-get-kernel   virt-make-fs         virt-tar-in

deps:
bin  include  lib  share

doc:
README

etc:
libguestfs-tools.conf  virt-builder  xdg

include:
guestfs-gobject  guestfs-gobject.h  guestfs.h

interface:
man  startup

lib:
appliance                  libguestfs-gobject-1.0.so.0      libguestfs_jni.so.1.32.10  pkgconfig
libguestfs.a               libguestfs-gobject-1.0.so.0.0.0  libguestfs.la              python3.6
libguestfs-gobject-1.0.a   libguestfs_jni.la                libguestfs.so
libguestfs-gobject-1.0.la  libguestfs_jni.so                libguestfs.so.0
libguestfs-gobject-1.0.so  libguestfs_jni.so.1              libguestfs.so.0.458.0

lib64:
guestfs  stublibs

man:
man1  man3  man5

seehelp:
libguestfs-1.32.10-2.el6.html

share:
doc  gtk-doc  java  javadoc  locale

4. We could see python-guestfs libraries in below path,

[root at euca-172-31-15-221 site-packages]$ pwd
/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages
[root at euca-172-31-15-221 site-packages]$ ls
guestfs.py  guestfs.pyc  guestfs.pyo

We are able to import guestfs without any issue like below:
[root at euca-172-31-15-221 ~]$ python
Python 3.6.0 (default, Jun  1 2017, 02:10:02)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import guestfs
>>>

But the issue is when we use "GuestFS" attribute like below:
>>> guestfs.GuestFS()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'guestfs' has no attribute 'GuestFS'

I have tried a lot to fix the issue and also google the same but no luck.
Please help me on this.

Regards,
Abinaya


-----Original Message-----
From: Richard W.M. Jones [mailto:rjones at redhat.com]
Sent: Thursday, January 25, 2018 4:00 PM
To: Abinaya Sandhiya Manikandan (GIS) <abinaya.manikandan at wipro.com>
Cc: libguestfs at redhat.com
Subject: Re: [Libguestfs] python 3 bindings on libguestfs

** This mail has been sent from an external source **

On Thu, Jan 25, 2018 at 10:25:16AM +0000, abinaya.manikandan at wipro.com wrote:
> Hi,
>
> Can you please let me know which all are the python versions
> (2.7/3.5/3.6) can enable in libguestfs_v13210.

Any version of Python can be used.

See also:

https://clicktime.symantec.com/a/1/qoKbsFMihHOWmj0p8BcJBr-MlL9BJTkzfYTr3kBV0SE=?d=YKtk1uvm5Nx3yeGZEYuU9aWY9KVSZEc1Tz3j_Tr1gsBiPSTKLztUcl5LzSvB5gegOZntTaIvCjTSfq7zLzl5HSS1uZSDCQg4FywAc4euKx2XGYMGOPpl53T407BalDrK5ehmNN81bc1DPSnpvjcSYichJVYB4A3xE8ed6RwHGrCcorLjLtortsXsn0n38CEYQCPPl5FxaNZx0y1gA08l-vpIajubSbsPKJc4Wi7G8WdJ3usBTH1qfAPsgqOxxItTJaq27pLepP85GbiJKNE4cl5WzCIBueVMxBI1dT8-K-1PfJil-z77voKyk5ovWt65T077uWR70qqo6xiRGykhlkf-PsmqxgSH7VMZHqkk-hihR3VrHhxhj9K0&u=http%3A%2F%2Flibguestfs.org%2Fguestfs-building.1.html%23building-python-2-and-python-3-bindings

Rich.

--
Richard Jones, Virtualization Group, Red Hat https://clicktime.symantec.com/a/1/pbXqVcQ3uEu6v0LMydvgvXy-NzoLXRVDjzq6OoLRfJ4=?d=YKtk1uvm5Nx3yeGZEYuU9aWY9KVSZEc1Tz3j_Tr1gsBiPSTKLztUcl5LzSvB5gegOZntTaIvCjTSfq7zLzl5HSS1uZSDCQg4FywAc4euKx2XGYMGOPpl53T407BalDrK5ehmNN81bc1DPSnpvjcSYichJVYB4A3xE8ed6RwHGrCcorLjLtortsXsn0n38CEYQCPPl5FxaNZx0y1gA08l-vpIajubSbsPKJc4Wi7G8WdJ3usBTH1qfAPsgqOxxItTJaq27pLepP85GbiJKNE4cl5WzCIBueVMxBI1dT8-K-1PfJil-z77voKyk5ovWt65T077uWR70qqo6xiRGykhlkf-PsmqxgSH7VMZHqkk-hihR3VrHhxhj9K0&u=http%3A%2F%2Fpeople.redhat.com%2F~rjones
Read my programming and virtualization blog: https://clicktime.symantec.com/a/1/386BbeBDj6ORryrimb0ZrwnXSrDL_6VkuIhbcdv-8I8=?d=YKtk1uvm5Nx3yeGZEYuU9aWY9KVSZEc1Tz3j_Tr1gsBiPSTKLztUcl5LzSvB5gegOZntTaIvCjTSfq7zLzl5HSS1uZSDCQg4FywAc4euKx2XGYMGOPpl53T407BalDrK5ehmNN81bc1DPSnpvjcSYichJVYB4A3xE8ed6RwHGrCcorLjLtortsXsn0n38CEYQCPPl5FxaNZx0y1gA08l-vpIajubSbsPKJc4Wi7G8WdJ3usBTH1qfAPsgqOxxItTJaq27pLepP85GbiJKNE4cl5WzCIBueVMxBI1dT8-K-1PfJil-z77voKyk5ovWt65T077uWR70qqo6xiRGykhlkf-PsmqxgSH7VMZHqkk-hihR3VrHhxhj9K0&u=http%3A%2F%2Frwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting, bindings from many languages.  https://clicktime.symantec.com/a/1/lxebQpCMO8fleDAyctDBuYzs51nL60SFwG1hffrEw5Q=?d=YKtk1uvm5Nx3yeGZEYuU9aWY9KVSZEc1Tz3j_Tr1gsBiPSTKLztUcl5LzSvB5gegOZntTaIvCjTSfq7zLzl5HSS1uZSDCQg4FywAc4euKx2XGYMGOPpl53T407BalDrK5ehmNN81bc1DPSnpvjcSYichJVYB4A3xE8ed6RwHGrCcorLjLtortsXsn0n38CEYQCPPl5FxaNZx0y1gA08l-vpIajubSbsPKJc4Wi7G8WdJ3usBTH1qfAPsgqOxxItTJaq27pLepP85GbiJKNE4cl5WzCIBueVMxBI1dT8-K-1PfJil-z77voKyk5ovWt65T077uWR70qqo6xiRGykhlkf-PsmqxgSH7VMZHqkk-hihR3VrHhxhj9K0&u=http%3A%2F%2Flibguestfs.org

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________




More information about the Libguestfs mailing list