- Timestamp:
- 2009-03-08T13:38:22Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0af8bcd
- Parents:
- ec944b1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/config.py
rec944b1 r31fb9a0 41 41 MACROS = 'config.h' 42 42 DEFS = 'config.defs' 43 PRECONF = 'defaults' 43 44 44 45 def read_defaults(fname, defaults): … … 277 278 outdf.close() 278 279 280 def sorted_dir(root): 281 list = os.listdir(root) 282 list.sort() 283 return list 284 285 def read_preconfigured(root, fname, screen, defaults): 286 options = [] 287 opt2path = {} 288 cnt = 0 289 290 # Look for profiles 291 for name in sorted_dir(root): 292 path = os.path.join(root, name) 293 canon = os.path.join(path, fname) 294 295 if ((os.path.isdir(path)) and (os.path.exists(canon)) and (os.path.isfile(canon))): 296 subprofile = False 297 298 # Look for subprofiles 299 for subname in sorted_dir(path): 300 subpath = os.path.join(path, subname) 301 subcanon = os.path.join(subpath, fname) 302 303 if ((os.path.isdir(subpath)) and (os.path.exists(subcanon)) and (os.path.isfile(subcanon))): 304 subprofile = True 305 options.append("%s (%s)" % (name, subname)) 306 opt2path[cnt] = (canon, subcanon) 307 cnt += 1 308 309 if (not subprofile): 310 options.append(name) 311 opt2path[cnt] = (canon, None) 312 cnt += 1 313 314 (button, value) = xtui.choice_window(screen, 'Load preconfigured defaults', 'Choose configuration profile', options, None) 315 316 if (button == 'cancel'): 317 return None 318 319 read_defaults(opt2path[value][0], defaults) 320 if (opt2path[value][1] != None): 321 read_defaults(opt2path[value][1], defaults) 322 279 323 def main(): 280 324 defaults = {} … … 303 347 try: 304 348 selname = None 349 position = None 305 350 while True: 306 351 … … 312 357 options = [] 313 358 opt2row = {} 314 position = None 315 cnt = 0 359 cnt = 1 360 361 options.append(" --- Load preconfigured defaults ... ") 362 316 363 for varname, vartype, name, choices, cond in ask_names: 317 364 … … 362 409 cnt += 1 363 410 411 if (position >= options): 412 position = None 413 364 414 (button, value) = xtui.choice_window(screen, 'HelenOS configuration', 'Choose configuration option', options, position) 365 415 … … 367 417 return 'Configuration canceled' 368 418 419 if (value == 0): 420 read_preconfigured(PRECONF, MAKEFILE, screen, defaults) 421 position = 1 422 continue 423 424 position = None 369 425 if (not opt2row.has_key(value)): 370 426 raise RuntimeError("Error selecting value: %s" % value)
Note:
See TracChangeset
for help on using the changeset viewer.