[bitbake-devel] [PATCH][V2] fetcher: use os.path.splitext() instead of string.split()

Ross Burton ross.burton at intel.com
Fri Jan 16 17:53:23 UTC 2015


Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 bitbake/lib/bb/fetch2/__init__.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 190de9e..4f95a16 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1199,9 +1199,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
-- 
1.7.10.4




More information about the bitbake-devel mailing list