Skip to content

Commit

Permalink
[IMP] cli first command testjs
Browse files Browse the repository at this point in the history
bzr revid: al@openerp.com-20121209024618-cae0ux1vmo38ccwr
  • Loading branch information
antonylesuisse committed Dec 9, 2012
1 parent fb0ded5 commit f224ce1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Depends:
python-libxslt1,
python-lxml,
python-mako,
python-mock,
python-openid,
python-psutil,
python-psycopg2,
Expand Down
19 changes: 19 additions & 0 deletions openerp/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import sys

import openerp
from openerp import tools
from openerp.modules import module

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -32,8 +34,25 @@ def run(self, args):

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:]

Expand Down
5 changes: 3 additions & 2 deletions openerp/modules/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ def clean(name):
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 = []
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def py2exe_options():
'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',
Expand Down

0 comments on commit f224ce1

Please sign in to comment.