Rename BmapFlash to BmapCopy
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 8 Nov 2012 14:52:07 +0000 (16:52 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 8 Nov 2012 17:01:22 +0000 (19:01 +0200)
Rename the module file name and the class name. There is a lot more to rename
and this is just the first step.

Change-Id: Ibee4082c783c5417401d10a41ef7787607108283
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptool
bmaptools/BmapCopy.py [moved from bmaptools/BmapFlash.py with 98% similarity]

index 92b1f98..8c9c307 100755 (executable)
--- a/bmaptool
+++ b/bmaptool
@@ -39,14 +39,14 @@ import argparse
 import sys
 import time
 import logging
-from bmaptools import BmapCreate, BmapFlash, BmapHelpers
+from bmaptools import BmapCreate, BmapCopy, BmapHelpers
 
 def copy_command(args, log):
     """ Copy an image to a block device or a regular file using bmap. """
 
     try:
-        writer = BmapFlash.BmapFlash(args.image, args.bdev, args.bmap)
-    except BmapFlash.Error as err:
+        writer = BmapCopy.BmapCopy(args.image, args.bdev, args.bmap)
+    except BmapCopy.Error as err:
         log.error(str(err))
         raise SystemExit(1)
 
@@ -67,7 +67,7 @@ def copy_command(args, log):
     try:
         try:
             writer.write(False, not args.no_verify)
-        except BmapFlash.Error as err:
+        except BmapCopy.Error as err:
             log.error(str(err))
             raise SystemExit(1)
 
@@ -75,7 +75,7 @@ def copy_command(args, log):
         log.info("synchronizing block device '%s'" % args.bdev)
         try:
             writer.sync()
-        except BmapFlash.Error as err:
+        except BmapCopy.Error as err:
             log.error(str(err))
             raise SystemExit(1)
     except KeyboardInterrupt:
@@ -183,7 +183,7 @@ def parse_arguments():
 
     # The first positional argument - image file
     text = "the image file to copy. Supported formats: uncompressed, " + \
-           ", ".join(BmapFlash.supported_image_formats)
+           ", ".join(BmapCopy.supported_image_formats)
     parser_copy.add_argument("image", help = text)
 
     # The second positional argument - block device node
similarity index 98%
rename from bmaptools/BmapFlash.py
rename to bmaptools/BmapCopy.py
index 50a130d..ebf2766 100644 (file)
@@ -1,6 +1,6 @@
 """
 This module implements flashing with block map (AKA bmap) and provides flashing
-API (in form of the 'BmapFlash' class).
+API (in form of the 'BmapCopy' class).
 
 The bmap contains list of blocks which have to be read from the image file and
 then written to the block device. The rest of the blocks are not required to be
@@ -31,12 +31,12 @@ supported_image_formats = ('bz2', 'gz', 'tar.gz', 'tgz', 'tar.bz2')
 supported_bmap_version = 1
 
 class Error(Exception):
-    """ A class for exceptions of BmapFlash. We currently support only one
+    """ A class for exceptions of BmapCopy. We currently support only one
         type of exceptions, and we basically throw human-readable problem
         description in case of errors. """
     pass
 
-class BmapFlash:
+class BmapCopy:
     """ This class implements all the bmap flashing functionality. To flash an
         image to a block device you should create an instance of this class and
         provide the following:
@@ -53,12 +53,12 @@ class BmapFlash:
         image. Compression type is defined by the image file extension.
         Supported types are listed by 'supported_image_formats'.
 
-        Once an instance of 'BmapFlash' is created, all the 'bmap_*'
+        Once an instance of 'BmapCopy' is created, all the 'bmap_*'
         attributes are initialized and available. They are read from the bmap.
         However, in case of bmap-less flashing, some of them (all the image
         size-related) are available only after writing the image, but not after
         creating the instance. The reason for this is that when bmap is absent,
-        'BmapFlash' uses sensible fall-back values for 'bmap_*' attributes
+        'BmapCopy' uses sensible fall-back values for 'bmap_*' attributes
         assuming the entire image is "mapped". And if the image is compressed,
         we cannot easily get the image size unless we decompress it, which is
         too time-consuming to do in '__init__()'. However, after the 'write()'