]> code.ossystems Code Review - openembedded-core.git/commit
relocate_sdk.py: make it work also with python 3
authorLaurentiu Palcu <laurentiu.palcu@intel.com>
Wed, 25 Sep 2013 09:32:33 +0000 (09:32 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 26 Sep 2013 15:37:13 +0000 (16:37 +0100)
commit175f20e27eadc79df16109961f5ce6232705e96f
tree49f6ecc5cdaf9538c8aac789c5b46a57b0f8ef7d
parent312b6b33dca565153bc2e92d7ff6dd2974db4edb
relocate_sdk.py: make it work also with python 3

Strings in Python 3, by default, are assumed to contain unicode
characters. In previous versions of python (<3), unicode strings are
explicitly declared with u"abc". If not, than they're automatically
converted to bytes. This doesn't happen anymore in Python 3.

Since we're dealing with binary files, opened in byte mode, make sure
that we explicitly convert all strings to bytes to make both python 2
and 3 happy.

Other changes:
 * add a safety check to make sure relocation did not change the file
   size;
 * a couple of cosmetic changes (wrap long lines so that we don't have
   to scroll to reach the end of them);

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/relocate_sdk.py