Changeset 253f8590 in mainline


Ignore:
Timestamp:
2005-12-07T00:41:35Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05e2a7ad
Parents:
994cf4b
Message:

Last bugfix tonight.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/config.py

    r994cf4b r253f8590  
    254254def parse_config(input, output, dlg, defaults={}, askonly=None):
    255255    "Parse configuration file and create Makefile.config on the fly"
     256    def ask_the_question():
     257        "Ask question based on the type of variables to ask"
     258        # This is quite a hack, this thingy is written just to
     259        # have access to local variables..
     260        if vartype == 'y/n':
     261            return dlg.yesno(comment, default)
     262        elif vartype == 'n/y':
     263            return dlg.noyes(comment, default)
     264        elif vartype == 'choice':
     265            defopt = None
     266            if default is not None:
     267                for i,(key,val) in enumerate(choices):
     268                    if key == default:
     269                        defopt = i
     270                        break
     271            return dlg.choice(comment, choices, defopt)
     272        else:
     273            raise RuntimeError("Bad method: %s" % vartype)
     274
     275   
    256276    f = file(input, 'r')
    257277    outf = file(output, 'w')
     
    304324            asked_names.append((varname,comment))
    305325
    306             if default is not None and askonly and askonly != varname:
    307                 outf.write('%s = %s\n' % (varname, default))
    308                 continue
    309 
    310             if vartype == 'y/n':
    311                 result = dlg.yesno(comment, default)
    312             elif vartype == 'n/y':
    313                 result = dlg.noyes(comment, default)
    314             elif vartype == 'choice':
    315                 defopt = None
    316                 if default is not None:
    317                     for i,(key,val) in enumerate(choices):
    318                         if key == default:
    319                             defopt = i
    320                             break
    321                 result = dlg.choice(comment, choices, defopt)
    322             else:
    323                 raise RuntimeError("Bad method: %s" % vartype)
    324             outf.write('%s = %s\n' % (varname, result))
     326            if default is None or not askonly or askonly == varname:
     327                default = ask_the_question()
     328
     329            outf.write('%s = %s\n' % (varname, default))
    325330            # Remeber the selected value
    326             defaults[varname] = result
     331            defaults[varname] = default
    327332            # Clear cumulated values
    328333            comment = ''
Note: See TracChangeset for help on using the changeset viewer.