diff --git a/debian/control b/debian/control index 7a1bfb62bb8..2017c34c105 100644 --- a/debian/control +++ b/debian/control @@ -23,6 +23,7 @@ Depends: python-libxslt1, python-lxml, python-mako, + python-mock, python-openid, python-psutil, python-psycopg2, diff --git a/openerp/cli/__init__.py b/openerp/cli/__init__.py index a48d20e4483..7111112c026 100644 --- a/openerp/cli/__init__.py +++ b/openerp/cli/__init__.py @@ -2,6 +2,8 @@ import logging import sys import openerp +from openerp import tools +from openerp.modules import module _logger = logging.getLogger(__name__) @@ -32,8 +34,25 @@ import server def main(): args = sys.argv[1:] + + # The only shared option is '--addons-path=' needed to discover additional + # commands from modules + if len(args) > 1 and args[0].startswith('--addons-path=') and not args[1].startswith("-"): + tools.config.parse_config([args[0]]) + args = args[1:] + + # Default legacy command command = "server" + + # Subcommand discovery if len(args) and not args[0].startswith("-"): + for m in module.get_modules(): + m = 'openerp.addons.' + m + __import__(m) + #try: + #except Exception, e: + # raise + # print e command = args[0] args = args[1:] diff --git a/openerp/modules/module.py b/openerp/modules/module.py index ca654b9a2eb..bb4ff481fb9 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -433,8 +433,9 @@ def get_modules(): return name def is_really_module(name): - name = opj(dir, name) - return os.path.isdir(name) or zipfile.is_zipfile(name) + manifest_name = opj(dir, name, '__openerp__.py') + zipfile_name = opj(dir, name) + return os.path.isfile(manifest_name) or zipfile.is_zipfile(zipfile_name) return map(clean, filter(is_really_module, os.listdir(dir))) plist = [] diff --git a/setup.py b/setup.py index 7d41e4d5c3c..5b1b2f43c0a 100755 --- a/setup.py +++ b/setup.py @@ -108,6 +108,7 @@ setuptools.setup( 'gdata', 'lxml < 3', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/ 'mako', + 'mock', 'PIL', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/ 'psutil', # windows binary code.google.com/p/psutil/downloads/list 'psycopg2',