diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-20 12:52:53 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-21 13:07:23 +0100 |
commit | 075296f3e5e5e3662290a888a6ba11229a36b95a (patch) | |
tree | 6afd26106b7e059f5aaaac2b2628eb4ecc094a69 | |
parent | e585730e931e6abdb15ba8a3849c5fd22845b891 (diff) | |
download | bitbake-075296f3e5e5e3662290a888a6ba11229a36b95a.tar.gz |
fetch2: Simplify some looping constructs in uri_replace()
(From Poky rev: c6bd25150a842a530f958d7233b15ae50d42c6c8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/fetch2/__init__.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 78adce2f2..ce2fb23b4 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -191,8 +191,7 @@ def uri_replace(ud, uri_find, uri_replace, d): uri_replace_decoded = list(decodeurl(uri_replace)) logger.debug(2, "For url %s comparing %s to %s" % (uri_decoded, uri_find_decoded, uri_replace_decoded)) result_decoded = ['', '', '', '', '', {}] - for i in uri_find_decoded: - loc = uri_find_decoded.index(i) + for loc, i in enumerate(uri_find_decoded): result_decoded[loc] = uri_decoded[loc] if isinstance(i, basestring): if (re.match(i, uri_decoded[loc])): @@ -200,7 +199,7 @@ def uri_replace(ud, uri_find, uri_replace, d): result_decoded[loc] = "" else: result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) - if uri_find_decoded.index(i) == 2: + if loc == 2: basename = None if ud.mirrortarball: basename = os.path.basename(ud.mirrortarball) |