liveusb/creator.py

Luke Macken lmacken at fedoraproject.org
Thu Jul 14 17:56:40 UTC 2011


 liveusb/creator.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 5ad19a4cf3d2c5f5741de0740757ba2240c56aa8
Author: Luke Macken <lmacken at redhat.com>
Date:   Thu Jul 14 13:55:52 2011 -0400

    Allow an optional callback in our detect_removable_devices method.

diff --git a/liveusb/creator.py b/liveusb/creator.py
index bd2a47b..22cc13a 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -85,7 +85,7 @@ class LiveUSBCreator(object):
         self.handler.setFormatter(formatter)
         self.log.addHandler(self.handler)
 
-    def detect_removable_drives(self):
+    def detect_removable_drives(self, callback=None):
         """ This method should populate self.drives with removable devices """
         raise NotImplementedError
 
@@ -937,7 +937,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
 
 class WindowsLiveUSBCreator(LiveUSBCreator):
 
-    def detect_removable_drives(self):
+    def detect_removable_drives(self, callback=None):
         import win32file, win32api, pywintypes
         self.drives = {}
         for drive in [l + ':' for l in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']:
@@ -965,6 +965,8 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
                 self.log.error(_("Error probing device"))
         if not len(self.drives):
             raise LiveUSBError(_("Unable to find any removable devices"))
+        if callback:
+            callback()
 
     def verify_filesystem(self):
         import win32api, win32file, pywintypes




More information about the liveusb-creator mailing list