Changeset 7178


Ignore:
Timestamp:
Jun 10, 2009, 5:32:07 PM (15 years ago)
Author:
rwilson
Message:

Added better defaults.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy_misc/tools/update_lic_checksum/create_lic_file.py

    r7156 r7178  
    4343    '''Create licence file 'lfile' that controls files in 'fnames'.'''
    4444
     45    # get username from the environment
     46    username = os.getenv('USERNAME')
     47
    4548    # see if there is already a licence file
    4649    if os.path.exists(lfile):
     
    5659    author = etree.SubElement(metadata, 'author')
    5760    author.tail = '\n  '
    58     if arg_author != '':
     61    if arg_author:
    5962        author.text = arg_author
     63    else:
     64        author.text = username
    6065
    6166    # add each controlled file to XML tree
    6267    prev_f_tree = None
     68    already_done = []       # list of handled files
    6369    for f in fnames:
     70        # check we haven't already handled this file
     71        if f in already_done:
     72            print("Have already seen file '%s': ignored" % f)
     73            continue
     74        already_done.append(f)
     75
    6476        # get new XML sub-tree for this file
    6577        f_tree = etree.fromstring(Datafile_Template)
     
    7486        if arg_accountable:
    7587            f_tree.find('accountable').text = arg_accountable
     88        else:
     89            f_tree.find('accountable').text = username
    7690        if arg_source:
    7791            f_tree.find('source').text = arg_source
     
    165179
    166180    create_file(lic_file, filenames,
    167                 arg_author, arg_publishable, arg_accountable,
    168                 arg_source, arg_ipowner, arg_ipinfo)
     181                arg_author=arg_author, arg_publishable=arg_publishable,
     182                arg_accountable=arg_accountable,
     183                arg_source=arg_source,  arg_ipowner=arg_ipowner,
     184                arg_ipinfo=arg_ipinfo)
    169185
    170186sys.exit(main(sys.argv[1:]))
Note: See TracChangeset for help on using the changeset viewer.