diff options
author | Thomas Jourdan <b.vehikel@googlemail.com> | 2010-01-09 21:24:55 (GMT) |
---|---|---|
committer | Thomas Jourdan <b.vehikel@googlemail.com> | 2010-01-09 21:24:55 (GMT) |
commit | 8d8009ea73b77fc37c165462b21a342fb3614416 (patch) | |
tree | d11735b60966666f7f180874f4ca6a167fc585e1 /ka_extensionpoint.py | |
parent | 9840852aca167c25c979fa08a23bc0fc623b680e (diff) |
Themes and categories for stamps.
Diffstat (limited to 'ka_extensionpoint.py')
-rw-r--r-- | ka_extensionpoint.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/ka_extensionpoint.py b/ka_extensionpoint.py index 03462e5..effc56b 100644 --- a/ka_extensionpoint.py +++ b/ka_extensionpoint.py @@ -15,8 +15,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import traceback +import sys import os -#import types +from ConfigParser import ConfigParser import ka_debug _PREFIX = 'ep_' @@ -25,6 +27,7 @@ _SEP = '_' _extension_types = [] _extensions = [] +revision_number = 0 def list_extensions(extension_type): """ @@ -70,9 +73,26 @@ def get_bundle_path(): bundle_path = activity.get_bundle_path() return bundle_path +def _get_manifest_version(bundle_path): + revision = 0 + try: + cp = ConfigParser() + cp.readfp(open(os.path.join(bundle_path, 'activity/activity.info'), 'rb')) + if cp.has_option('Activity', 'activity_version'): + version = cp.get('Activity', 'activity_version') + revision = int(version) + except: + ka_debug.err('reading manifest version failed [%s] [%s]' % \ + (sys.exc_info()[0], sys.exc_info()[1])) + traceback.print_exc(file=sys.__stderr__) + return revision + def scann(): + global revision_number bundle_path = get_bundle_path() - ka_debug.info('searching for extensions in ' + bundle_path) + revision_number = _get_manifest_version(bundle_path) + ka_debug.info('This is Kandid, release v' + str(revision_number)) + ka_debug.info('Searching for extensions in ' + bundle_path) for element in os.listdir(bundle_path): if element.startswith(_PREFIX) and element.endswith(_PYEXT) \ and os.path.isfile(os.path.join(bundle_path, element)): |