[Sugar-devel] [PATCH] Adding another path for lookup of mfg-data directory

Gonzalo Odiard gonzalo at laptop.org
Wed Nov 23 13:32:49 EST 2011


Thanks, pushed

Gonzalo

On Tue, Nov 22, 2011 at 8:45 AM, Manuel Quiñones <manuq at laptop.org> wrote:

> The mfg-data directory is located in another path for some builds, so
> the activity has to check in both places for existence.  This fixes
> Log for olpc #11116.
>
> Signed-off-by: Manuel Quiñones <manuq at laptop.org>
> ---
>  logcollect.py |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/logcollect.py b/logcollect.py
> index a1251a4..82c1bba 100644
> --- a/logcollect.py
> +++ b/logcollect.py
> @@ -51,6 +51,9 @@ import httplib
>  import mimetypes
>  import urlparse
>
> +MFG_DATA_PATHS = ['/ofw/mfg-data/', '/proc/device-tree/mfg-data/']
> +
> +
>  class MachineProperties:
>     """Various machine properties in easy to access chunks.
>     """
> @@ -111,12 +114,17 @@ class MachineProperties:
>                 return line[8:].strip()
>
>     def _mfg_data(self, item):
> -        """Return mfg data item from /ofw/mfg-data/"""
> -
> -        if not os.path.exists('/ofw/mfg-data/'+item):
> +        """Return mfg data item from mfg-data directory"""
> +
> +        mfg_path = None
> +        for test_path in MFG_DATA_PATHS:
> +            if os.path.exists(test_path + item):
> +                mfg_path = test_path + item
> +                break
> +        if mfg_path == None:
>             return ''
> -
> -        v = self.__read_file('/ofw/mfg-data/'+item)
> +
> +        v = self.__read_file(mfg_path)
>         # Remove trailing 0 character, if any:
>         if v != '' and ord(v[len(v)-1]) == 0:
>             v = v[:len(v)-1]
> --
> 1.7.7.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111123/fa928bc5/attachment.html>


More information about the Sugar-devel mailing list