BmapFlasher: provide a list of supported image formats
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 31 Oct 2012 12:09:08 +0000 (14:09 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 1 Nov 2012 06:59:03 +0000 (08:59 +0200)
Change-Id: I45b8014c14dfe863190ce2967c151b269d2c9af9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
BmapFlasher.py
bmap-flasher

index 867bacc..5c9de88 100644 (file)
@@ -13,6 +13,9 @@ import os
 import hashlib
 from xml.etree import ElementTree
 
+# A list of supported image formats
+supported_image_formats = ('bz2', 'gz', 'tar.gz', 'tgz', 'tar.bz2')
+
 # The highest supported bmap format version
 supported_bmap_version = 1
 
@@ -54,7 +57,7 @@ class BmapFlasher:
     def _open_image_file(self):
         """ Open the image The image file may be uncompressed or compressed.
             The compression type is recognized by the file extention. Supported
-            types are: .tar.gz, .tar.bz2, .tgz, .gz, and .bz2. """
+            types are defined by 'supported_image_formats' """
 
         try:
             if self._image_path.endswith('.tar.gz') \
index 145baa5..33fd966 100755 (executable)
@@ -52,8 +52,8 @@ def parse_arguments():
     parser.add_argument("bdev", help = text)
 
     # The second command-line argument - image file
-    text = "The image file to flash. Supported formats: uncompressed, " \
-           ".tar.bz2, .tar.gz, .bz2, .gz."
+    text = "The image file to flash. Supported formats: uncompressed, " \
+           ", ".join(BmapFlasher.supported_image_formats)
     parser.add_argument("image", help = text)
 
     # The --bmap option