mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-protocol
synced 2025-12-29 17:07:13 +00:00
codegen: Use six.PY3 rather than six.PY2
Older versions of python-six (at least 1.3.0) defined six.PY3 but not six.PY2. six.PY2 is only used twice in straightforward tests so it's easy to use six.PY3 instead.
This commit is contained in:
parent
e919337980
commit
3cc9566a00
@ -121,10 +121,10 @@ class CodeWriter:
|
||||
|
||||
def write(self, s):
|
||||
# Ensure its a unicode string
|
||||
if six.PY2:
|
||||
s = unicode(s)
|
||||
else:
|
||||
if six.PY3:
|
||||
s = str(s)
|
||||
else:
|
||||
s = unicode(s)
|
||||
|
||||
if len(s) == 0:
|
||||
return
|
||||
|
||||
@ -265,10 +265,10 @@ if options.keep_identical_file:
|
||||
pass
|
||||
|
||||
f = open(dest_file, 'wb')
|
||||
if six.PY2:
|
||||
f.write(content)
|
||||
else:
|
||||
if six.PY3:
|
||||
f.write(bytes(content, 'UTF-8'))
|
||||
else:
|
||||
f.write(content)
|
||||
f.close()
|
||||
|
||||
six.print_("Wrote %s" % dest_file)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user