Ticket #1442: 0001-Support-sugar_version-field-in-activity.info.patch

File 0001-Support-sugar_version-field-in-activity.info.patch, 1.7 KB (added by wadeb, 15 years ago)
  • src/sugar/bundle/activitybundle.py

    From ce42db4843c3048f31fa42cb0707b50a723e82dd Mon Sep 17 00:00:00 2001
    From: Wade Brainerd <wadetb@gmail.com>
    Date: Sun, 27 Sep 2009 19:58:50 -0400
    Subject: [PATCH] Support sugar_version field in activity.info
    
    ---
     src/sugar/bundle/activitybundle.py |    8 ++++++++
     1 files changed, 8 insertions(+), 0 deletions(-)
    
    diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
    index a1f10b9..026062f 100644
    a b class ActivityBundle(Bundle): 
    5959        self._activity_version = 0
    6060        self._installation_time = os.stat(path).st_mtime
    6161        self._manifest = None
     62        self._sugar_version = '0.0.0'
    6263
    6364        info_file = self.get_file('activity/activity.info')
    6465        if info_file is None:
    class ActivityBundle(Bundle): 
    193194                    'Activity bundle %s has invalid version number %s' %
    194195                    (self._path, version))
    195196
     197        if cp.has_option(section, 'sugar_version'):
     198            self._sugar_version = cp.get(section, 'sugar_version')
     199
    196200    def _get_linfo_file(self):
    197201        lang = locale.getdefaultlocale()[0]
    198202        if not lang:
    class ActivityBundle(Bundle): 
    292296        """Get whether there should be a visible launcher for the activity"""
    293297        return self._show_launcher
    294298
     299    def get_sugar_version(self):
     300        """Get the minimum Sugar version required to launch the activity"""
     301        return self._sugar_version
     302
    295303    def install(self, install_dir=None, strict_manifest=False):
    296304        if install_dir is None:
    297305            install_dir = env.get_user_activities_path()