[anaconda 2/2] Be more liberal in what is accepted as a size unit.
David Shea
dshea at redhat.com
Mon Jan 20 22:26:33 UTC 2014
Not all size specifications will end with a letter. For example: the
translation of "B" for byte in Telugu ends with a vowel sign,
categorized in Unicode as a non-spacing mark. Instead check whether the
size string ends with a [0-9]: if so, the unit is missing.
---
pyanaconda/ui/gui/spokes/custom.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 4b94628..dd3afdc 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -31,6 +31,7 @@
from contextlib import contextmanager
import re
+import locale
from pykickstart.constants import CLEARPART_TYPE_NONE, AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, AUTOPART_TYPE_LVM_THINP
@@ -162,10 +163,11 @@ partition_only_format_types = ["efi", "macefi", "prepboot", "biosboot",
"appleboot"]
def size_from_entry(entry):
- size_text = entry.get_text().strip()
+ size_text = entry.get_text().decode("utf-8").strip()
- # if no unit was specified, default to MiB
- if not re.search(r'[A-Za-z]+$', size_text):
+ # if no unit was specified, default to MiB. Assume that a string
+ # ending with anything other than a digit has a unit suffix
+ if not size_text or re.search(r'[\d.%s]$' % locale.nl_langinfo(locale.RADIXCHAR), size_text):
size_text += "MiB"
try:
--
1.8.4.2
More information about the anaconda-patches
mailing list