Changeset beb39ee3 in mainline
- Timestamp:
- 2005-12-07T00:27:36Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 994cf4b
- Parents:
- a80d406
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel.config
ra80d406 rbeb39ee3 9 9 @ "sparc64" Sun UltraSPARC 10 10 ! ARCH (choice) 11 12 %ASKDEFAULT13 11 14 12 # IA32 Compiler -
tools/config.py
ra80d406 rbeb39ee3 78 78 else: 79 79 sys.stdout.write('Enter choice number: ') 80 81 def menu(self, text, choices, button, defopt=None): 82 return self.choice(text, [button] + choices) 80 83 81 84 def choice(self, text, choices, defopt=None): … … 103 106 NoDialog.__init__(self) 104 107 self.dlgcmd = os.environ.get('DIALOG','dialog') 105 self.title = 'HelenOS Configuration' 108 self.title = '' 109 self.backtitle = 'HelenOS Kernel Configuration' 106 110 107 111 if os.system('%s --print-maxsize >/dev/null 2>&1' % self.dlgcmd) != 0: … … 120 124 os.close(indesc) 121 125 122 dlgargs = [self.dlgcmd,'--title',self.title] 126 dlgargs = [self.dlgcmd,'--title',self.title, 127 '--backtitle', self.backtitle] 123 128 for key,val in kw.items(): 124 129 dlgargs.append('--'+key) … … 157 162 return 'y' 158 163 return 'n' 164 165 def menu(self, text, choices, button, defopt=None): 166 text = text + ':' 167 width = '70' 168 height = str(8 + len(choices)) 169 args = [] 170 for key,val in choices: 171 args.append(key) 172 args.append(val) 173 174 kw = {} 175 if defopt: 176 kw['default-item'] = choices[defopt][0] 177 res,data = self.calldlg('--cancel-label',button[1], 178 '--menu',text,height,width, 179 str(len(choices)),*args,**kw) 180 if res == 1: 181 return button[0] 182 elif res: 183 print data 184 raise EOFError 185 return data 159 186 160 187 def choice(self, text, choices, defopt=None): … … 220 247 return False 221 248 222 def parse_config(input, output, dlg, defaults={} ):249 def parse_config(input, output, dlg, defaults={}, askonly=None): 223 250 "Parse configuration file and create Makefile.config on the fly" 224 251 f = file(input, 'r') … … 228 255 outf.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n') 229 256 outf.write('#########################################\n\n') 257 258 asked_names = [] 230 259 231 260 comment = '' … … 243 272 cmd = args[0].lower() 244 273 args = args[1:] 245 if cmd == 'askdefault': 246 if isinstance(dlg, DefaultDialog): 247 continue 248 res = dlg.noyes('Change kernel configuration') 249 if res == 'n': 250 dlg = DefaultDialog(dlg) 251 elif cmd == 'saveas': 274 if cmd == 'saveas': 252 275 outf.write('%s = %s\n' % (args[1],defaults[args[0]])) 253 276 … … 263 286 264 287 default = defaults.get(varname,None) 265 288 266 289 if res.group(1): 267 290 if not check_condition(res.group(1), defaults): … … 273 296 choices = [] 274 297 continue 298 299 asked_names.append((varname,comment)) 300 301 if default is not None and askonly and askonly != varname: 302 outf.write('%s = %s\n' % (varname, default)) 303 continue 275 304 276 305 if vartype == 'y/n': … … 319 348 outf.close() 320 349 f.close() 350 return asked_names 321 351 322 352 def main(): … … 327 357 dlg = NoDialog() 328 358 359 if len(sys.argv) == 2 and sys.argv[1]=='default': 360 defmode = True 361 else: 362 defmode = False 363 329 364 # Default run will update the configuration file 330 365 # with newest options 331 if len(sys.argv) == 2 and sys.argv[1]=='default':332 dlg = DefaultDialog(dlg)333 334 366 if os.path.exists(OUTPUT): 335 367 read_defaults(OUTPUT, defaults) 336 368 337 parse_config(INPUT, TMPOUTPUT, dlg, defaults) 369 varnames = parse_config(INPUT, TMPOUTPUT, DefaultDialog(dlg), defaults) 370 # If not in default mode, present selection of all possibilities 371 if not defmode: 372 defopt = 0 373 while 1: 374 choices = [ (x[1],defaults[x[0]]) for x in varnames ] 375 res = dlg.menu('Configuration',choices,('save','Save'),defopt) 376 if res == 'save': 377 parse_config(INPUT, TMPOUTPUT, DefaultDialog(dlg), defaults) 378 break 379 # transfer description back to varname 380 for i,(vname,descr) in enumerate(varnames): 381 if res == descr: 382 defopt = i 383 break 384 varnames = parse_config(INPUT, TMPOUTPUT, dlg, defaults, 385 askonly=varnames[i][0]) 386 387 338 388 if os.path.exists(OUTPUT): 339 389 os.unlink(OUTPUT)
Note:
See TracChangeset
for help on using the changeset viewer.