2009-12-02 10:06:58 +00:00
|
|
|
#!/usr/bin/env python
|
2009-10-20 10:52:23 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2008-06-16 07:24:04 +00:00
|
|
|
##############################################################################
|
2010-03-11 08:49:41 +00:00
|
|
|
#
|
2009-10-14 12:32:15 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
2008-06-16 07:24:04 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 12:32:15 +00:00
|
|
|
# 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.
|
2008-06-16 07:24:04 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# 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
|
2009-10-14 12:32:15 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2008-06-16 07:24:04 +00:00
|
|
|
#
|
2009-10-14 12:32:15 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-03-11 08:49:41 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-06-16 07:24:04 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2009-01-20 10:42:02 +00:00
|
|
|
# TODO handle the case of zip modules
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
import os
|
2007-08-02 12:09:30 +00:00
|
|
|
import sys
|
2008-05-29 05:25:36 +00:00
|
|
|
import glob
|
2007-08-02 12:09:30 +00:00
|
|
|
|
2008-05-29 05:25:36 +00:00
|
|
|
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)
|
2007-08-02 12:09:30 +00:00
|
|
|
|
|
|
|
modules = sys.argv[1:]
|
2008-05-29 05:25:36 +00:00
|
|
|
if not len(modules):
|
2010-03-11 08:49:41 +00:00
|
|
|
modules = map(os.path.dirname, glob.glob(os.path.join('*', '__openerp__.py')))
|
|
|
|
modules += map(os.path.dirname, glob.glob(os.path.join('*', '__terp__.py')))
|
2008-05-29 05:25:36 +00:00
|
|
|
|
2007-08-02 12:09:30 +00:00
|
|
|
done = []
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
print 'digraph G {'
|
2007-08-02 12:09:30 +00:00
|
|
|
while len(modules):
|
2008-07-22 14:24:36 +00:00
|
|
|
f = modules.pop(0)
|
|
|
|
done.append(f)
|
2010-03-12 06:15:00 +00:00
|
|
|
info = addons.load_information_from_description_file(f)
|
|
|
|
if info.get('installable', True):
|
|
|
|
for name in info['depends']:
|
|
|
|
if name not in done+modules:
|
|
|
|
modules.append(name)
|
|
|
|
if not os.path.exists(name):
|
|
|
|
print '\t%s [color=red]' % (name,)
|
|
|
|
print '\t%s -> %s;' % (f, name)
|
2006-12-07 13:41:40 +00:00
|
|
|
print '}'
|
2008-07-23 15:01:27 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|