BmapFlasher: move constant to the module level
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 31 Oct 2012 12:05:31 +0000 (14:05 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 1 Nov 2012 06:59:03 +0000 (08:59 +0200)
The maximum supported bmap version is actually a module-level attribute, not a
class-level attribute - move it to the module level.

Change-Id: Ie2911478048da4e9ed4c2747e72f5222cd22071b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
BmapFlasher.py

index fa79640..867bacc 100644 (file)
@@ -13,6 +13,9 @@ import os
 import hashlib
 from xml.etree import ElementTree
 
+# The highest supported bmap format version
+supported_bmap_version = 1
+
 class Error(Exception):
     """ A class for exceptions of BmapFlasher. """
     pass
@@ -34,10 +37,10 @@ class BmapFlasher:
 
         # Make sure we support this version
         major = int(self.bmap_version.split('.', 1)[0])
-        if major > self.bmap_max_version:
+        if major > supported_bmap_version:
             raise Error("only bmap format version up to %d is supported, " \
                         "version %d is not supported" \
-                        % (self.bmap_max_version, major))
+                        % (supported_bmap_version, major))
 
         # Fetch interesting data from the bmap XML file
         self.bmap_block_size = int(xml.find("BlockSize").text.strip())
@@ -117,7 +120,6 @@ class BmapFlasher:
         self._f_bmap  = None
 
         self._xml = None
-        self.bmap_max_version = 1
         self.bmap_version = None
         self.bmap_block_size = None
         self.bmap_blocks_cnt = None