[Libguestfs] [PATCH RHEL 7] RHEL 7: -o rhv-upload: Use Python 2 instead of Python

Richard W.M. Jones rjones at redhat.com
Mon Mar 12 12:56:12 UTC 2018


For interest only, here is the patch required to make -o rhv-upload
work with Python 2 (for RHEL 7).  I don't think we want this upstream.
A couple of remarks:

* It's supposed to be possible to add ‘coding: utf-8’ to the top of
  .py files to make Python 2 accept that the file is UTF-8 (otherwise
  it gives an error on loading).  However I added this and it didn't
  appear to make any difference, I still had to replace the Unicode
  quotes with ASCII ones, so I don't know what's going on there.

* The ‘byteify’ function is a bit of a hack, but required here because
  the Python 2 json library returns unicode objects where all the rest
  of the libraries are expecting str.  Not needed in Python 3 of course.

Rich.




More information about the Libguestfs mailing list