On Wed, Oct 16, 2013 at 11:44:59AM -0400, Konrad Scherer wrote: > From: Konrad Scherer <konrad.sche...@windriver.com> > > Python 2.4 does not support the 'b' string literal or the > keyword 'as' in exception handling. Python 3 does not accept > the old method of exception handling and defaults to unicode. > The b() function converts strings to bytes on Python 3 and > using sys.exc_info() avoids the exception handling syntax. > > Signed-off-by: Konrad Scherer <konrad.sche...@windriver.com> > --- > scripts/relocate_sdk.py | 43 ++++++++++++++++++++++++++----------------- > 1 file changed, 26 insertions(+), 17 deletions(-) > > diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py > index fe6e4e0..a15302d 100755 > --- a/scripts/relocate_sdk.py > +++ b/scripts/relocate_sdk.py > @@ -31,7 +31,15 @@ import os > import re > import errno > > -old_prefix = re.compile(b"##DEFAULT_INSTALL_DIR##") > +if sys.version < '3': > + def b(x): > + return x > +else: > + import codecs I can drop this import.
Thanks, Laurentiu > + def b(x): > + return x.encode(sys.getfilesystemencoding()) > + > +old_prefix = re.compile(b("##DEFAULT_INSTALL_DIR##")) > _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core