[FIX] Integrate the load_information_from_description_file function from addons in the module_graph script

bzr revid: stephane@openerp.com-20100427082252-bfmb0yt0kwry9y6v
This commit is contained in:
Stephane Wirtel 2010-04-27 10:22:52 +02:00
parent a4f00ad02f
commit 09c6859236
1 changed files with 12 additions and 1 deletions

View File

@ -26,6 +26,17 @@ import os
import sys
import glob
def load_information_from_description_file(module):
"""
:param module: The name of the module (sale, purchase, ...)
"""
for filename in ['__openerp__.py', '__terp__.py']:
description_file = os.path.join(module, filename)
if os.path.isfile(description_file):
return eval(file(description_file).read())
return {}
if len(sys.argv) == 2 and (sys.argv[1] in ['-h', '--help']):
print >>sys.stderr, 'Usage: module_graph.py [module1 module2 module3]\n\tWhen no module is specified, all modules in current directory are used'
sys.exit(1)
@ -41,7 +52,7 @@ print 'digraph G {'
while len(modules):
f = modules.pop(0)
done.append(f)
info = addons.load_information_from_description_file(f)
info = load_information_from_description_file(f)
if info.get('installable', True):
for name in info['depends']:
if name not in done+modules: