odoo.cli.main()指的是哪里?OpenERP的第二根线头儿

接上回,odoo-bin中调用了odoo.cli.main(),去哪儿找?

cli目录容易找

跟随__init__.py的脚步

 1 import logging
 2 import sys
 3 import os
 4 
 5 import odoo
 6 
 7 from command import Command, main
 8 
 9 import deploy
10 import scaffold
11 import server
12 import shell
13 import start

see line 7

我们发现程序从command中引入了command类?和main函数

then goto command.py

搜索 main()

我们发现

 1         print "\nUse '%s <command> --help' for individual command help." % sys.argv[0].split(os.path.sep)[-1]
 2 
 3 def main():
 4     args = sys.argv[1:]
 5 
 6     # The only shared option is '--addons-path=' needed to discover additional
 7     # commands from modules
 8     if len(args) > 1 and args[0].startswith('--addons-path=') and not args[1].startswith("-"):
 9         # parse only the addons-path, do not setup the logger...
10         odoo.tools.config._parse_config([args[0]])
11         args = args[1:]
12 
13     # Default legacy command
14     command = "server"

我想就是这里了

TODO:main()做了什么?

转载于:https://www.cnblogs.com/qianheng/p/6240739.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值