[master/f20/rhel7-branch] Always use decimal notation for Size specs

David Shea dshea at redhat.com
Tue Oct 22 20:08:53 UTC 2013


%s sometimes outputs in exponential format, which breaks blivet's Size
spec parsing. Use the decimal format conversion type instead.

Resolves: rhbz#999440
---
 pyanaconda/ui/gui/spokes/custom.py     | 2 +-
 pyanaconda/ui/gui/spokes/lib/resize.py | 4 ++--
 pyanaconda/ui/gui/spokes/storage.py    | 2 +-
 pyanaconda/ui/lib/disks.py             | 2 +-
 pyanaconda/ui/tui/spokes/storage.py    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 48e58e7..20c1777 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -831,7 +831,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         for disk in self._clearpartDevices:
             totalSpace += disk.size
 
-        return Size(spec="%s MB" % totalSpace)
+        return Size(spec="%f MB" % totalSpace)
 
     def _updateSpaceDisplay(self):
         # Set up the free space/available space displays in the bottom left.
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index e118445..c81774e 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -380,7 +380,7 @@ class ResizeDialog(GUIObject):
         self._diskStore.foreach(self._sumReclaimableSpace, None)
         self._update_labels(selectedReclaimable=self._selectedReclaimableSpace)
 
-        self._update_reclaim_button(Size(spec="%s MB" % self._selectedReclaimableSpace))
+        self._update_reclaim_button(Size(spec="%f MB" % self._selectedReclaimableSpace))
         self._update_action_buttons(selectedRow)
 
     def _scheduleActions(self, model, path, itr, *args):
@@ -462,7 +462,7 @@ class ResizeDialog(GUIObject):
         self._update_labels(selectedReclaimable=self._selectedReclaimableSpace)
 
         # And then the reclaim button, in case they've made enough space.
-        self._update_reclaim_button(Size(spec="%s MB" % self._selectedReclaimableSpace))
+        self._update_reclaim_button(Size(spec="%f MB" % self._selectedReclaimableSpace))
 
     def resize_slider_format(self, scale, value):
         # This makes the value displayed under the slider prettier than just a
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 6e777d9..f3313a8 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -704,7 +704,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         summary = (P_("%(count)d disk selected; %(capacity)s capacity; %(free)s free",
                       "%(count)d disks selected; %(capacity)s capacity; %(free)s free",
                       count) % {"count" : count,
-                                "capacity" : str(Size(spec="%s MB" % capacity)),
+                                "capacity" : str(Size(spec="%f MB" % capacity)),
                                 "free" : free})
         summary_label = self.builder.get_object("summary_label")
         summary_label.set_text(summary)
diff --git a/pyanaconda/ui/lib/disks.py b/pyanaconda/ui/lib/disks.py
index 00e1700..4dcd701 100644
--- a/pyanaconda/ui/lib/disks.py
+++ b/pyanaconda/ui/lib/disks.py
@@ -77,6 +77,6 @@ def size_str(mb):
     if isinstance(mb, Size):
         spec = str(mb)
     else:
-        spec = "%s mb" % mb
+        spec = "%f mb" % mb
 
     return str(Size(spec=spec)).upper()
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 15a9bdd..2fbbd7b 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -161,7 +161,7 @@ class StorageSpoke(NormalTUISpoke):
 
         summary = (P_(("%d disk selected; %s capacity; %s free ..."),
                       ("%d disks selected; %s capacity; %s free ..."),
-                      count) % (count, str(Size(spec="%s MB" % capacity)), free))
+                      count) % (count, str(Size(spec="%f MB" % capacity)), free))
 
         if len(self.disks) == 0:
             summary = _("No disks detected.  Please shut down the computer, connect at least one disk, and restart to complete installation.")
-- 
1.8.3.1



More information about the anaconda-patches mailing list