Mercurial > p > roundup > code
comparison demo.py @ 4729:3fa74b99d42d
Fix `demo -h` didn't work with existing demo, and
required nuke to read the help
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Mon, 14 Jan 2013 14:55:54 +0300 |
| parents | 324cbd9f7d0e |
| children | a0654b1283a4 |
comparison
equal
deleted
inserted
replaced
| 4728:4caa6de726a5 | 4729:3fa74b99d42d |
|---|---|
| 147 try: | 147 try: |
| 148 opts, args = getopt.getopt(sys.argv[1:], 't:b:h') | 148 opts, args = getopt.getopt(sys.argv[1:], 't:b:h') |
| 149 except getopt.GetoptError, e: | 149 except getopt.GetoptError, e: |
| 150 usage(str(e)) | 150 usage(str(e)) |
| 151 return 1 | 151 return 1 |
| 152 for opt, arg in opts: | |
| 153 if opt == '-h': | |
| 154 usage() | |
| 155 return 0 | |
| 152 | 156 |
| 153 home = os.path.abspath('demo') | 157 home = os.path.abspath('demo') |
| 154 nuke = args and args[0] == 'nuke' | 158 nuke = args and args[0] == 'nuke' |
| 155 if not os.path.exists(home) or nuke: | 159 if not os.path.exists(home) or nuke: |
| 156 backend = 'anydbm' | 160 backend = 'anydbm' |
| 157 template = 'classic' | 161 template = 'classic' |
| 158 for opt, arg in opts: | 162 for opt, arg in opts: |
| 159 if opt == '-h': | 163 if opt == '-t': |
| 160 usage() | |
| 161 return 0 | |
| 162 elif opt == '-t': | |
| 163 template = arg | 164 template = arg |
| 164 elif opt == '-b': | 165 elif opt == '-b': |
| 165 backend = arg | 166 backend = arg |
| 166 if (len(args) > 1 or | 167 if (len(args) > 1 or |
| 167 (len(args) == 1 and args[0] != 'nuke')): | 168 (len(args) == 1 and args[0] != 'nuke')): |
