Skip to contentSkip to conversation

fetcher: use os.path.splitext() instead of string.split()

PATCH New Ross Burton 1 participant 1 message Jan 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fetcher: use os.path.splitext() instead of string.split()

---
 bitbake/lib/bb/fetch2/__init__.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/fetch2/__init__.py +3 -3
index 190de9e..4f95a16 100644
@@ -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
Signature · 1 line
1.7.10.4