[Dextrose] [olpc-updater PATCH] au#825: Check for a existence for an already existing "library" bundle; else the corresponding "activity" will be continued to be shown as new in "Software-Update".

Jerry Vonau jvonau at shaw.ca
Thu Mar 15 05:26:17 EDT 2012


On Thu, 2012-03-15 at 12:07 +0530, Ajay Garg wrote:
> diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
> index 974c050..60195c7 100755
> --- a/extensions/cpsection/updater/model.py
> +++ b/extensions/cpsection/updater/model.py
> @@ -413,7 +413,11 @@ class UpdateList(gtk.ListStore):
>                  zf.getinfo('%s/activity/activity.info' % activity_base)
>                  is_activity = True
>              except KeyError:
> -                is_activity = False
> +                try:
> +                    zf.getinfo('%s/library/library.info' % activity_base)
> +                    is_activity = True
> +                except:
> +                    is_activity = False
>              if is_activity:
>                  cp = actutils.activity_info_from_zipfile(zf)
>                  SECTION = 'Activity'

How about this:
--- src/model.py.orig	2011-05-30 15:16:53.000000000 -0500
+++ src/model.py	2012-03-15 03:59:53.630674825 -0500
@@ -411,16 +411,18 @@
             activity_base = actutils.bundle_base_from_zipfile(zf)
             try:
                 zf.getinfo('%s/activity/activity.info' % activity_base)
-                is_activity = True
-            except KeyError:
-                is_activity = False
-            if is_activity:
                 cp = actutils.activity_info_from_zipfile(zf)
                 SECTION = 'Activity'
-            else:
-                cp = actutils.library_info_from_zipfile(zf)
-                SECTION = 'Library'
-            act_id = None
+            except KeyError:
+                try:
+                    # grab data from library.info file
+                    zf.getinfo('%s/library/library.info' %
activity_base)
+                    act_id = None
+                        cp = actutils.library_info_from_zipfile(zf)
+                        SECTION = 'Library'
+                execpt:
+                    raise RuntimeError("zf not found for %s" %zf)
+
             for fieldname in ('bundle_id', 'service_name',
'global_name'):
                 if cp.has_option(SECTION, fieldname):
                     act_id = cp.get(SECTION, fieldname)






More information about the Dextrose mailing list