fix postupdate
This commit is contained in:
parent
557f4d3ea9
commit
f69377408d
1 changed files with 10 additions and 11 deletions
|
@ -81,16 +81,15 @@ def command_postupdate(*args):
|
||||||
"""
|
"""
|
||||||
Called after update with -o old -n new
|
Called after update with -o old -n new
|
||||||
"""
|
"""
|
||||||
def run(*args):
|
o, old, n, new = args
|
||||||
o, old, n, new = args
|
if o != '-o' or n != '-n':
|
||||||
if o != '-o' or n != '-n':
|
print('usage: -o oldversion -n newversion')
|
||||||
print('usage: -o oldversion -n newversion')
|
sys.exit(1)
|
||||||
sys.exit(1)
|
if old <= '20140521-65-e14c686' and new > '20140521-65-e14c686':
|
||||||
if old <= '20140521-65-e14c686' and new > '20140521-65-e14c686':
|
if not os.path.exists(settings.db_path):
|
||||||
if not os.path.exists(settings.db_path):
|
r('./ctl', 'setup')
|
||||||
r('./ctl', 'setup')
|
import setup
|
||||||
import setup
|
setup.upgrade_db(old, new)
|
||||||
setup.upgrade_db(old, new)
|
|
||||||
|
|
||||||
def command_setup(*args):
|
def command_setup(*args):
|
||||||
"""
|
"""
|
||||||
|
@ -214,7 +213,7 @@ def main():
|
||||||
commands = [c[8:] for c in actions if c.startswith('command_')]
|
commands = [c[8:] for c in actions if c.startswith('command_')]
|
||||||
command = sys.argv[1] if len(sys.argv) > 1 else None
|
command = sys.argv[1] if len(sys.argv) > 1 else None
|
||||||
if command and command in commands:
|
if command and command in commands:
|
||||||
globals()["command_%s"%command](sys.argv[1:])
|
globals()["command_%s"%command](*sys.argv[2:])
|
||||||
else:
|
else:
|
||||||
print("usage: ctl [action]")
|
print("usage: ctl [action]")
|
||||||
indent = max([len(command) for command in commands]) + 4
|
indent = max([len(command) for command in commands]) + 4
|
||||||
|
|
Loading…
Add table
Reference in a new issue