pmrep: revert to ascii
commit18d662737355564a651196ec5165cfbb5649f2fb
authorMarko Myllynen <myllynen@redhat.com>
Wed, 20 Jul 2016 23:13:54 +0000 (21 09:13 +1000)
committerNathan Scott <nathans@redhat.com>
Wed, 20 Jul 2016 23:13:54 +0000 (21 09:13 +1000)
tree69f34abf0a790e73def3c0b9b2adcb99890fa2e9
parent1f0ee8705d108b628e59746e851f51fd1599190c
pmrep: revert to ascii

In 06b8c19 we compressed the pmrep unit strings in headers and for
microseconds we used non-ascii µs form. This works with Python 3
but we failed to remember that with Python 2 strings are not
Unicode by default and later when formatting the output, it's the
format string's encoding that determines the encoding used.

So this is what we should use:

#!/usr/bin/python2
# -*- coding: utf-8 -*-

a = [":", "u/s", ":", "us/s", ":"]
u = [":", u"µs/s", ":", u"µs/s", ":"]
fmt = u"{0}{1:>15.15}{2}{3:>15.15}{4}"
print(fmt.format(*tuple(a)))
print(fmt.format(*tuple(u)))

Without using unicode formatting will be off as multi-byte
characters take the same screen estate as single-byte chars.

But: even after the corresponding changes to pmrep I still get QA
failures with Python 2 here. Given the recent Python QA issue Ken
has hit elsewhere it sounds like this might be a recipe for lots
of additional QA headaches so I'm leaning towards reverting back
to ASCII. And "us" instead "µs" is already used elsewhere in PCP.
Later, if wanted, once the QA is on green on again we can see if
we want introduce this (not-so-critical) change again.
src/pmrep/pmrep.py