From d4493ed301c05f22f8fabdb5a2fd0ebfc98d08f6 Mon Sep 17 00:00:00 2001 From: David Shea Date: Wed, 15 Jan 2014 16:54:46 -0500 Subject: [PATCH 10/27] Be more liberal in what is accepted as a size unit. 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. (cherry picked from commit a9e107499f1c99b11b6ab4780d5191e031367df2) --- pyanaconda/ui/gui/spokes/custom.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 93bfc3b..a63f1f0 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -171,10 +171,15 @@ partition_only_format_types = ["efi", "hfs+", "prepboot", "biosboot", system_mountpoints = ["/dev", "/proc", "/run", "/sys"] 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): + # Nothing to parse + if not size_text: + return None + + # if no unit was specified, default to MiB. Assume that a string + # ending with anything other than a digit has a unit suffix + if re.search(r'[\d.%s]$' % locale.nl_langinfo(locale.RADIXCHAR), size_text): size_text += "MiB" # Nothing to parse -- 1.9.3