def install_depends(argv, prog): """ 安装程序需要的依赖(假定是在当前目录下获取octopus.prj,用处是帮助在本地搭建环境) """ argparser = argparse.ArgumentParser(description="octopus install_depends", prog=prog) argparser.add_argument('-c', '--conf', dest='config_file', help='octopus配置文件路径, 寻找优先级为./octopus.conf > ~/.octopus/octopus.conf') argparser.add_argument('-t', '--type', dest='type',default='all', help='要安装的依赖类型,取值为compile, runtime, all') args = argparser.parse_args(argv) config_file = get_config_file(args.config_file) print 'use config ' + config_file if config_file is None: print "please specift config file" return 1 if args.type != 'compile' and args.type != 'runtime' and args.type != 'all': print 'wrong type, must be [compile, runtime, all]' return 1 citool = CITool(config_file) program_path = '.' program_info = ProgramInfo(program_path) citool.install_depends(program_info.get_depends(), args.type)