[PATCH] Adapt to the new libxklavier's behaviour

Vratislav Podzimek vpodzime at redhat.com
Fri Mar 8 08:51:57 UTC 2013


On Thu, 2013-03-07 at 20:33 -0600, David Lehman wrote:
> On Thu, 2013-03-07 at 16:42 +0100, Vratislav Podzimek wrote:
> > On Thu, 2013-03-07 at 16:24 +0100, Vratislav Podzimek wrote:
> > > libxklavier now returns lists of ordinal numbers of chars instead of
> > > null-byte terminated strings.
> > > 
> > > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > > ---
> > >  pyanaconda/keyboard.py | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
> > > index fc4914a..6407b98 100755
> > > --- a/pyanaconda/keyboard.py
> > > +++ b/pyanaconda/keyboard.py
> > > @@ -292,8 +292,9 @@ def activate_keyboard(keyboard):
> > >  def item_str(s):
> > >      """Convert a zero-terminated byte array to a proper str"""
> > >  
> > > -    i = s.find(b'\x00')
> > > -    return s[:i].decode("utf-8") #there are some non-ascii layout descriptions
> > > +    i = s.index(0)
> > > +    s = "".join(chr(char) for char in s[:i])
> > There needs to be 'if char <= 255' added here^
> 
> I still got tracebacks with that because one of the values was something
> like -59, so I took a hint from that traceback and replaced "if char <=
> 255" with "if char in range(256)", which worked.
Yeah, I'd seen it too and fixed it locally just before I left the office
yesterday.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list