[Sugar-devel] [PATCH sugar] Control Panel: making about my computer section hardware independent, OLPC #11232

James Cameron quozl at laptop.org
Mon Oct 10 20:35:58 EDT 2011


On Sun, Oct 09, 2011 at 08:55:27PM +0200, Sascha Silbe wrote:
> def _parse_firmware_number(firmware_no):
>     if firmware_no is None:
>         return _not_available
> 
>     firmware_no = firmware_no.replace('\0', ' ').strip()
> 
>     # try to extract Open Firmware version from OLPC style version
>     # string, e.g. "CL2   Q4B11  Q4B"
>     if len(firmware_no) != 16:
>         return firmware_no
> 
>     fields = re.split(' +', firmware_no)
>     if len(fields) != 3 or not fields[1].startswith(fields[2]):
>         return firmware_no
> 
>     return fields[1]

No, do not split only by space, because we use two letter suffix for
developer releases of OpenFirmware, like so:

"CL2   Q4B11jaQ4B"

Instead, separate by character position.

"CL2   " (6 characters)
"Q4B11ja" (7 characters)
"Q4B" (3 characters)

On the other hand, we might add another space, not sure.  That would
break your length check.  Waiting for a reply from Mitch.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list