2 # -*- coding: utf-8 -*-
6 """Simple package manager"""
7 def __init__(self
, config
, args
):
9 self
.dirs
, self
.depends
, self
.mirrors
, self
.args
, self
.modules
, self
.db_name
= config
.dirs
, config
.depends
, config
.mirrors
, args
, {}, config
.db_name
12 # print 'You have error in config file!'
15 def prepare_cmd(self
):
18 self
.action
= [ self
.args
[0], self
.args
[1:] ]
20 if not self
.modules
.has_key(self
.action
[0]):
21 module
= __import__(self
.action
[0])
22 module
= module
.module()
23 self
.modules
[self
.action
[0]] = module
25 print """I can't found module file!"""
27 print """Usage lori <action> <action's args>"""
30 for module
in self
.modules
:
31 getattr(self
.modules
[module
], "install")(self
, self
.action
[1])
33 def load_sqlite(self
):
35 self
.sqlite
= sqlite
.sqlite()
36 getattr(self
.sqlite
, 'install')(self
)
38 def do_sql(self
, cmd
):
40 getattr(self
.sqlite
, cmd
)(self
)