* [PATCH] Maintain compatability with Python 2.4
@ 2010-06-01 14:43 Joshua Lock
0 siblings, 0 replies; only message in thread
From: Joshua Lock @ 2010-06-01 14:43 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
Hi,
I just found this patch lying around, I forgot to submit it here.
A user contacted me about requiring Python 2.5 features in
relocatable.bbclass when OE claims Python 2.4 support.
I wrote them this patch and haven't heard any complaints back so assume
it works as intended, however I haven't tested it much myself.
When I raised the Python 2.4 vs 2.5 issue a while back it seems the
consensus was to stick to 2.4 support as RHEL still uses it.
Anyone care to merge?
Thanks,
Joshua
--
Joshua Lock
Intel Open Source Technology Centre
[-- Attachment #2: 0001-relocatable.bbclass-don-t-use-Python-2.5-features.patch --]
[-- Type: text/x-patch, Size: 3346 bytes --]
From 72399a3064367c92fcb7fe832adca289de0c10b2 Mon Sep 17 00:00:00 2001
From: Joshua Lock <josh@linux.intel.com>
Date: Mon, 10 May 2010 17:01:35 +0100
Subject: [PATCH] relocatable.bbclass: don't use Python 2.5 features
str.partition() is a "new" method for Python 2.5, as we claim Pyhton 2.4 or
above is required in the wiki we shouldn't use methods which aren't available
in Python 2.4.
This patch adds a (horrible) method, string_after() to replace the use of
str.partition()
Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
classes/relocatable.bbclass | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/classes/relocatable.bbclass b/classes/relocatable.bbclass
index eb5b9e6..cb82315 100644
--- a/classes/relocatable.bbclass
+++ b/classes/relocatable.bbclass
@@ -3,6 +3,11 @@ SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
CHRPATH_BIN ?= "chrpath"
PREPROCESS_RELOCATE_DIRS ?= ""
+def string_after(target, split):
+ target = target.strip().lstrip()
+ tmp = target[target.rfind(split):len(target)]
+ return tmp[len(split):len(target)]
+
def process_dir (directory, d):
import subprocess as sub
import stat
@@ -44,7 +49,7 @@ def process_dir (directory, d):
continue
# Throw away everything other than the rpath list
- curr_rpath = err.partition("RPATH=")[2]
+ curr_rpath = string_after(err, "RPATH=")
#bb.note("Current rpath for %s is %s" % (fpath, curr_rpath.strip()))
rpaths = curr_rpath.split(":")
new_rpaths = []
@@ -55,15 +60,12 @@ def process_dir (directory, d):
# If the rpath shares a root with base_prefix determine a new dynamic rpath from the
# base_prefix shared root
if rpath.find(basedir) != -1:
- depth = fpath.partition(basedir)[2].count('/')
- libpath = rpath.partition(basedir)[2].strip()
+ depth = string_after(fpath, basedir).count('/')
+ libpath = string_after(rpath, basedir).strip()
# otherwise (i.e. cross packages) determine a shared root based on the TMPDIR
- # NOTE: This will not work reliably for cross packages, particularly in the case
- # where your TMPDIR is a short path (i.e. /usr/poky) as chrpath cannot insert an
- # rpath longer than that which is already set.
else:
- depth = fpath.rpartition(tmpdir)[2].count('/')
- libpath = rpath.partition(tmpdir)[2].strip()
+ depth = string_after(rpath, tmpdir).count('/')
+ libpath = string_after(rpath, tmpdir).strip()
base = "$ORIGIN"
while depth > 1:
@@ -74,7 +76,7 @@ def process_dir (directory, d):
# if we have modified some rpaths call chrpath to update the binary
if len(new_rpaths):
args = ":".join(new_rpaths)
- #bb.note("Setting rpath for %s to %s" %(fpath,args))
+ #bb.note("Setting rpath for %s to %s" %(fpath, args))
sub.call([cmd, '-r', args, fpath])
if perms:
--
1.6.6.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-01 14:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01 14:43 [PATCH] Maintain compatability with Python 2.4 Joshua Lock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox