From: Ross Burton Date: Fri, 16 Jan 2015 17:53:23 +0000 (+0000) Subject: fetcher: use os.path.splitext() instead of string.split() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1689edd35477a126bfbf4bd3257c4f1f9e16f20d;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git fetcher: use os.path.splitext() instead of string.split() Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index f97eaf43998..599ea8c822f 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -1201,9 +1201,9 @@ class FetchMethod(object): bb.fatal("Invalid value for 'unpack' parameter for %s: %s" % (file, urldata.parm.get('unpack'))) - dots = file.split(".") - if dots[-1] in ['gz', 'bz2', 'Z', 'xz', 'lz']: - efile = os.path.join(rootdir, os.path.basename('.'.join(dots[0:-1]))) + base, ext = os.path.splitext(file) + if ext in ['.gz', '.bz2', '.Z', '.xz', '.lz']: + efile = os.path.join(rootdir, os.path.basename(base)) else: efile = file cmd = None