From cade65d7ebc054a89f2d6b92b26dff8b748a8fbd Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 21 Sep 2009 19:51:02 +0000 Subject: Fix decodeint() for py3k compat, since bytes are a sequence of integers instead of characters. svn path=/main/trunk/; revision=14361 --- pym/portage/xpak.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py index b5878befb..8838891ca 100644 --- a/pym/portage/xpak.py +++ b/pym/portage/xpak.py @@ -19,6 +19,7 @@ import array import errno import shutil +import sys from portage import os from portage import normalize_path @@ -65,11 +66,13 @@ def encodeint(myint): def decodeint(mystring): """Takes a 4 byte string and converts it into a 4 byte integer. Returns an integer.""" - myint=0 - myint=myint+ord(mystring[3]) - myint=myint+(ord(mystring[2]) << 8) - myint=myint+(ord(mystring[1]) << 16) - myint=myint+(ord(mystring[0]) << 24) + if sys.hexversion < 0x3000000: + mystring = [ord(x) for x in mystring] + myint = 0 + myint += mystring[3] + myint += mystring[2] << 8 + myint += mystring[1] << 16 + myint += mystring[0] << 24 return myint def xpak(rootdir,outfile=None): -- cgit v1.2.3-1-g7c22