summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/wizard/base_module_scan.py
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2011-02-07 13:57:23 +0100
committerVo Minh Thu <vmt@openerp.com>2011-02-07 13:57:23 +0100
commitf8572e5c602798f37c2a94d54ab5e3ac79ff0185 (patch)
tree35687977b932ac91bd31fece229ab78cc70926f5 /bin/addons/base/module/wizard/base_module_scan.py
parent9c287abc143a7b187635c75751a29baeefa58c15 (diff)
[IMP] openerp python module.
- Some logging code moved from netsvc.py to loglevels.py - Changed imports to use the new openerp module - config and netsvc initialization calls move to openerp-server.py - Moved openerp-server.py outside the old bin directory - Some imports in tools moved inside the methods to break mutual-dependencies bzr revid: vmt@openerp.com-20110207125723-ooee7d7ng5elmkso
Diffstat (limited to 'bin/addons/base/module/wizard/base_module_scan.py')
-rw-r--r--bin/addons/base/module/wizard/base_module_scan.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/bin/addons/base/module/wizard/base_module_scan.py b/bin/addons/base/module/wizard/base_module_scan.py
deleted file mode 100644
index d47e091955f..00000000000
--- a/bin/addons/base/module/wizard/base_module_scan.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-import os
-import glob
-import imp
-
-import tools
-
-import zipfile
-from osv import osv
-
-class base_module_scan(osv.osv_memory):
- """ scan module """
-
- _name = "base.module.scan"
- _description = "scan module"
-
- def watch_dir(self, cr, uid, ids, context):
- mod_obj = self.pool.get('ir.module.module')
- all_mods = mod_obj.read(cr, uid, mod_obj.search(cr, uid, []), ['name', 'state'])
- known_modules = [x['name'] for x in all_mods]
- ls_ad = glob.glob(os.path.join(tools.config['addons_path'], '*', '__terp__.py'))
- modules = [module_name_re.match(name).group(1) for name in ls_ad]
- for fname in os.listdir(tools.config['addons_path']):
- if zipfile.is_zipfile(fname):
- modules.append( fname.split('.')[0])
- for module in modules:
- if module in known_modules:
- continue
- terp = mod_obj.get_module_info(module)
- if not terp.get('installable', True):
- continue
-
- # XXX check if this code is correct...
- fm = imp.find_module(module)
- try:
- imp.load_module(module, *fm)
- finally:
- if fm[0]:
- fm[0].close()
-
- values = mod_obj.get_values_from_terp(terp)
- mod_id = mod_obj.create(cr, uid, dict(name=module, state='uninstalled', **values))
- dependencies = terp.get('depends', [])
- for d in dependencies:
- cr.execute('insert into ir_module_module_dependency (module_id,name) values (%s, %s)', (mod_id, d))
- for module in known_modules:
- terp = mod_obj.get_module_info(module)
- if terp.get('installable', True):
- for mod in all_mods:
- if mod['name'] == module and mod['state'] == 'uninstallable':
- mod_obj.write(cr, uid, [mod['id']], {'state': 'uninstalled'})
- return {}
-
-base_module_scan() \ No newline at end of file