Mercurial > p > roundup > code
comparison roundup/scripts/roundup_demo.py @ 2777:baaf90070dc4
instant-gratification script for binary distributions
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Mon, 18 Oct 2004 07:56:09 +0000 |
| parents | |
| children | 01e8be352fb8 |
comparison
equal
deleted
inserted
replaced
| 2776:10e96f3ee658 | 2777:baaf90070dc4 |
|---|---|
| 1 #! /usr/bin/env python | |
| 2 # | |
| 3 # Copyright 2004 Richard Jones (richard@mechanicalcat.net) | |
| 4 # | |
| 5 # $Id: roundup_demo.py,v 1.1 2004-10-18 07:56:09 a1s Exp $ | |
| 6 | |
| 7 import sys | |
| 8 | |
| 9 from roundup import admin, configuration, demo, instance | |
| 10 from roundup.i18n import _ | |
| 11 | |
| 12 DEFAULT_HOME = './demo' | |
| 13 | |
| 14 def run(): | |
| 15 home = DEFAULT_HOME | |
| 16 nuke = sys.argv[-1] == 'nuke' | |
| 17 # if there is no tracker in home, force nuke | |
| 18 try: | |
| 19 instance.open(home) | |
| 20 except configuration.NoConfigError: | |
| 21 nuke = 1 | |
| 22 # if we are to create the tracker, prompt for home | |
| 23 if nuke: | |
| 24 if len(sys.argv) > 2: | |
| 25 backend = sys.argv[-2] | |
| 26 else: | |
| 27 backend = 'anydbm' | |
| 28 # FIXME: i'd like to have an option to abort the tracker creation | |
| 29 # say, by entering a single dot. but i cannot think of | |
| 30 # appropriate prompt for that. | |
| 31 home = raw_input( | |
| 32 _('Enter directory path to create demo tracker [%s]: ') % home) | |
| 33 if not home: | |
| 34 home = DEFAULT_HOME | |
| 35 # install | |
| 36 demo.install_demo(home, backend, | |
| 37 admin.AdminTool().listTemplates()['classic']['path']) | |
| 38 # run | |
| 39 demo.run_demo(home) | |
| 40 | |
| 41 if __name__ == '__main__': | |
| 42 run() | |
| 43 | |
| 44 # vim: set et sts=4 sw=4 : |
