commit 42ace959b13633144426e80ccf4a8e991e5206a8
Author: Nikos Skalkotos <skalkoto@grnet.gr>
Date:   Tue Apr 24 12:45:49 2012 +0300

    Switch to ansicolor for coloring & fix pep8 errors

diff --git a/image_creator/disk.py b/image_creator/disk.py
index e0ed6a1..71c7f17 100644
--- a/image_creator/disk.py
+++ b/image_creator/disk.py
@@ -336,7 +336,6 @@ class DiskDevice(object):
                 dest.close()
         finally:
             source.close()
-        
         output("\rDumping image file...\033[K", False)
         success('image file %s was successfully created' % outfile)
 
diff --git a/image_creator/kamaki_wrapper.py b/image_creator/kamaki_wrapper.py
index f325be0..56fd382 100644
--- a/image_creator/kamaki_wrapper.py
+++ b/image_creator/kamaki_wrapper.py
@@ -61,6 +61,7 @@ def progress(message):
         yield
     return progress_gen
 
+
 class Kamaki:
     def __init__(self, account, token):
         self.account = account
@@ -100,7 +101,8 @@ class Kamaki:
             raise FatalError("Pithos client: %d %s" % (e.status, e.message))
 
     def register(self, name, location, metadata):
-        params = {'is_public':'true', 'disk_format':'diskdump'}
+
+        params = {'is_public': 'true', 'disk_format': 'diskdump'}
         try:
             self.image_client.register(name, location, params, metadata)
         except ClientError as e:
diff --git a/image_creator/main.py b/image_creator/main.py
index 3207c87..86b74cc 100755
--- a/image_creator/main.py
+++ b/image_creator/main.py
@@ -210,7 +210,8 @@ def image_creator():
 
             output('Dumping md5sum file...', False)
             with open('%s.%s' % (options.outfile, 'md5sum'), 'w') as f:
-                f.write('%s %s'% (checksum, os.path.basename(options.outfile)))
+                f.write('%s %s' % (
+                                checksum, os.path.basename(options.outfile)))
             success('done')
 
         # Destroy the device. We only need the snapshot from now on
@@ -239,9 +240,9 @@ def image_creator():
             output()
 
         if options.register:
-            output('Registing image to ~okeanos...')
+            output('Registing image to ~okeanos...', False)
             kamaki.register(options.register, uploaded_obj, metadata)
-            output('done')
+            success('done')
             output()
 
     finally:
diff --git a/image_creator/util.py b/image_creator/util.py
index 3cacba0..efccabb 100644
--- a/image_creator/util.py
+++ b/image_creator/util.py
@@ -34,7 +34,7 @@
 import sys
 import pbs
 import hashlib
-from clint.textui import colored
+from colors import red, green, yellow
 from progress.bar import Bar
 
 
@@ -61,19 +61,19 @@ def get_command(command):
 
 def error(msg, new_line=True):
     nl = "\n" if new_line else ''
-    sys.stderr.write(colored.red('Error: %s' % msg) + nl)
+    sys.stderr.write(red('Error: %s' % msg) + nl)
 
 
 def warn(msg, new_line=True):
     if not silent:
         nl = "\n" if new_line else ''
-        sys.stderr.write(colored.yellow("Warning: %s" % msg) + nl)
+        sys.stderr.write(yellow("Warning: %s" % msg) + nl)
 
 
 def success(msg, new_line=True):
     if not silent:
         nl = "\n" if new_line else ''
-        sys.stdout.write(colored.green(msg) + nl)
+        sys.stdout.write(green(msg) + nl)
         if not nl:
             sys.stdout.flush()
 
@@ -89,15 +89,24 @@ def output(msg="", new_line=True):
 def progress(message='', bar_type="default"):
 
     MESSAGE_LENGTH = 30
-    
-    suffix={'default':'%(index)d/%(max)d',
-        'percent':'%(percent)d%%',
-        'b':'%(index)d/%(max)d B',
-        'kb':'%(index)d/%(max)d KB',
-        'mb':'%(index)d/%(max)d MB'}
 
-    return Bar(message=message.ljust(MESSAGE_LENGTH), fill='#', \
-                                                    suffix=suffix[bar_type])
+    suffix = {
+        'default': '%(index)d/%(max)d',
+        'percent': '%(percent)d%%',
+        'b': '%(index)d/%(max)d B',
+        'kb': '%(index)d/%(max)d KB',
+        'mb': '%(index)d/%(max)d MB'
+    }
+
+    bar = Bar()
+    bar.message = message.ljust(MESSAGE_LENGTH)
+    bar.fill = '#'
+    bar.suffix = suffix[bar_type]
+    bar.bar_prefix = ' ['
+    bar.bar_suffix = '] '
+
+    return bar
+
 
 def md5(filename, size):
 
@@ -114,7 +123,7 @@ def md5(filename, size):
             md5.update(data)
             left -= length
             progressbar.goto((size - left) // (2 ** 20))
-    
+
     checksum = md5.hexdigest()
     output("\rCalculating md5sum...\033[K", False)
     success(checksum)
diff --git a/setup.py b/setup.py
index 29f0cd5..0e65cb0 100755
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@ setup(
     license='BSD',
     packages=['image_creator', 'image_creator.os_type'],
     include_package_data=True,
-    install_requires=['pbs', 'clint', 'progress','pysendfile'],
+    install_requires=['pbs', 'ansicolors', 'progress', 'pysendfile'],
     entry_points={
         'console_scripts': ['snf-image-creator = image_creator.main:main']
     }
