[virt-tools-list] argparse and Python 2.6

Cole Robinson crobinso at redhat.com
Sun May 8 15:16:51 UTC 2016


On 05/07/2016 10:53 PM, Programmingkid wrote:
> 
> On May 7, 2016, at 7:31 PM, Cole Robinson wrote:
> 
>> On 05/06/2016 11:51 AM, Programmingkid wrote:
>>>
>>> On May 6, 2016, at 7:52 AM, Cole Robinson wrote:
>>>
>>>> On 05/05/2016 10:49 PM, Programmingkid wrote:
>>>>> I was trying to run virt-clone.py, when I encountered an error. This file uses argparse. This feature was not added to Python until 2.7. I'm using Python 2.6. The INSTALL document says python >= 2.6 is needed. The simplest way to fix this problem is to update the INSTALL document to say "python >= 2.7". Does this sound like the correct solution?
>>>>
>>>> Thanks for the report. Yes updating the docs is the best fix
>>>>
>>>> - Cole
>>>
>>> Thank you very much for helping. Would you know if there is a python script that tries to detect what requirements for Virt-Manager is missing? If there isn't one, I could make one myself.
>>>
>>
>> Hmm, interesting idea but not really sure where it would best live. We can put
>> it in setup.py, but then my recommendation to people that want to use
>> virt-manager.git is just to run virt-manager right from the git repo without
>> invoking setup.py, which wouldn't get the benefit. Not sure if you have any
>> thoughts
>>
>> - Cole
> 
> My idea for a verify_system_requirements() function is something like this:
> 
> if gtk+3 not found
> 	tell user to install gtk+ v3.6 or higher
> 

Importing gtk3 will fail if DISPLAY is unset IIRC, there's special handling
for this in virt-manager since you don't want to give a false negative just
because DISPLAY is unset

> if gtk+ version < 3.6
> 	tell user to upgrade gtk+ to at least version 3.6
> 
> if python version < 2.7
> 	tell user to upgrade python to at least version 2.7
> 
> if python version >= 3.0
> 	tell user this program might not be compatible with python 3    * not sure about this
> 

Correct, we don't work with python3 yet. That said it will probably take extra
work to get the code to even _parse_ with python3, so this check might not
ever be reached depending on where it's wired up

> if pygobject3 not found
> 	tell user to install pygobject version 3.4 or higher
> 
> if pygobject version < 3.4
> 	tell user to upgrade pygobject to at least version 3.4
> 
> if libosinfo not found
> 	tell user to install libosinfo 0.2.10 or higher
> 
> if libosinfo version < 0.2.10
> 	tell user to upgrade libosinfo to at least v0.2.10
> 
> Once this is turned into a patch, finding out exactly what is wrong with Virt-manager will be easy.
> 
> I am not sure about libvirt-python. I think it might be possible to use Virt-manager with QEMU in emulation mode, without needing libvirt.
> 

libvirt is 100% required, it doesn't talk directly to qemu. There's also a
libvirt version check in ./virt-manager IIRC, but it's virt-manager only and
doesn't affect virt-install. Also the gtk/ui deps don't matter for
virt-install either so there's some issues there.

- Cole




More information about the virt-tools-list mailing list