From 9f9de9914a96b462ce0ea62fdda14e397a331f02 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 24 Aug 2012 16:23:23 +0200 Subject: [FIX] automatically adapt version numbers of modules bzr revid: chs@openerp.com-20120824142323-m503lc6tfj4vntop --- openerp/modules/module.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'openerp/modules/module.py') diff --git a/openerp/modules/module.py b/openerp/modules/module.py index b1d4de31bce..1f11ad21b37 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). -# Copyright (C) 2010-2011 OpenERP s.a. (). +# Copyright (C) 2010-2012 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -337,7 +337,7 @@ def load_information_from_description_file(module): 'license': 'AGPL-3', 'name': False, 'post_load': None, - 'version': '0.0.0', + 'version': '1.0', 'web': False, 'website': '', 'sequence': 100, @@ -357,6 +357,7 @@ def load_information_from_description_file(module): # 'active' has been renamed 'auto_install' info['auto_install'] = info['active'] + info['version'] = adapt_version(info['version']) return info #TODO: refactor the logger in this file to follow the logging guidelines @@ -454,15 +455,22 @@ def get_modules(): def get_modules_with_version(): modules = get_modules() - res = {} + res = dict.fromkeys(modules, adapt_version('1.0')) for module in modules: try: info = load_information_from_description_file(module) - res[module] = "%s.%s" % (release.major_version, info['version']) - except Exception, e: + res[module] = info['version'] + except Exception: continue return res +def adapt_version(version): + serie = release.major_version + if version == serie or not version.startswith(serie + '.'): + version = '%s.%s' % (serie, version) + return version + + def get_test_modules(module, submodule, explode): """ Return a list of submodules containing tests. -- cgit v1.2.3