-
Notifications
You must be signed in to change notification settings - Fork 2
/
odoo.insmod
executable file
·39 lines (33 loc) · 1.02 KB
/
odoo.insmod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/env python
"""Install or upgrade an Odoo module
"""
import sys
import argparse
from oekit import oe_client_env
from os.path import (abspath, basename)
def main(options):
"""Main program."""
env = oe_client_env.OEClientEnv()
client = env.get_erppeek_client()
modules = map(resolve_module, options.modules)
if options.upgrade:
client.upgrade(*modules)
else:
client.install(*modules)
return
def resolve_module(module):
if set('./').intersection(module):
return basename(abspath(module))
else:
return module
def get_options():
"""Get options for the script."""
parser = argparse.ArgumentParser(
description="Install or upgrade an Odoo module",
)
parser.add_argument('modules', nargs='+', help='name the modules to install')
parser.add_argument('-u', '--upgrade', action='store_true', help='update not install the listed modules')
options = parser.parse_args()
return options
if __name__ == "__main__":
main(get_options())