Changeset 829 for trunk


Ignore:
Timestamp:
12/21/08 16:04:24 (3 years ago)
Author:
wd
Message:

Update scons

Location:
trunk/ithildin/build
Files:
188 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ithildin/build/scons-LICENSE

    r805 r829  
    44        with which this software may have been included. 
    55 
    6 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation 
     6Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation 
    77 
    88Permission is hereby granted, free of charge, to any person obtaining 
  • trunk/ithildin/build/scons-README

    r805 r829  
    1 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation 
     1# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation 
    22 
    33                 SCons - a software construction tool 
  • trunk/ithildin/build/scons.py

    r805 r829  
    33# SCons - a Software Constructor 
    44# 
    5 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation 
     5# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation 
    66# 
    77# Permission is hereby granted, free of charge, to any person obtaining 
     
    2525# 
    2626 
    27 __revision__ = "/home/scons/scons/branch.0/baseline/src/script/scons.py 0.97.D001 2007/05/17 11:35:19 knight" 
     27__revision__ = "src/script/scons.py 3842 2008/12/20 22:59:52 scons" 
    2828 
    29 __version__ = "0.97" 
     29__version__ = "1.2.0" 
    3030 
    31 __build__ = "D001" 
     31__build__ = "r3842" 
    3232 
    33 __buildsys__ = "roxbury" 
     33__buildsys__ = "scons-dev" 
    3434 
    35 __date__ = "2007/05/17 11:35:19" 
     35__date__ = "2008/12/20 22:59:52" 
    3636 
    37 __developer__ = "knight" 
     37__developer__ = "scons" 
    3838 
    3939import os 
     
    6767    libs.append(os.environ["SCONS_LIB_DIR"]) 
    6868 
    69 local = 'scons-local-' + __version__ 
     69local_version = 'scons-local-' + __version__ 
     70local = 'scons-local' 
    7071if script_dir: 
     72    local_version = os.path.join(script_dir, local_version) 
    7173    local = os.path.join(script_dir, local) 
     74libs.append(os.path.abspath(local_version)) 
    7275libs.append(os.path.abspath(local)) 
    7376 
     
    138141        pass 
    139142    else: 
    140         while libpath: 
    141             libpath, tail = os.path.split(libpath) 
    142             if tail[:6] == "python": 
    143                 break 
    144         if libpath: 
    145             # Python library is in /usr/libfoo/python*; 
    146             # check /usr/libfoo/scons*. 
    147             prefs.append(libpath) 
     143        # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*. 
     144        libpath, tail = os.path.split(libpath) 
     145        # Split /usr/libfoo/python* to /usr/libfoo 
     146        libpath, tail = os.path.split(libpath) 
     147        # Check /usr/libfoo/scons*. 
     148        prefs.append(libpath) 
    148149 
    149150# Look first for 'scons-__version__' in all of our preference libs, 
     
    158159############################################################################## 
    159160 
    160 import SCons.Script 
    161 SCons.Script.main() 
     161if __name__ == "__main__": 
     162    import SCons.Script 
     163    # this does all the work, and calls sys.exit 
     164    # with the proper exit status when done. 
     165    SCons.Script.main() 
  • trunk/ithildin/build/sconsign.py

    r805 r829  
    33# SCons - a Software Constructor 
    44# 
    5 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation 
     5# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation 
    66# 
    77# Permission is hereby granted, free of charge, to any person obtaining 
     
    2525# 
    2626 
    27 __revision__ = "/home/scons/scons/branch.0/baseline/src/script/sconsign.py 0.97.D001 2007/05/17 11:35:19 knight" 
    28  
    29 __version__ = "0.97" 
    30  
    31 __build__ = "D001" 
    32  
    33 __buildsys__ = "roxbury" 
    34  
    35 __date__ = "2007/05/17 11:35:19" 
    36  
    37 __developer__ = "knight" 
     27__revision__ = "src/script/sconsign.py 3842 2008/12/20 22:59:52 scons" 
     28 
     29__version__ = "1.2.0" 
     30 
     31__build__ = "r3842" 
     32 
     33__buildsys__ = "scons-dev" 
     34 
     35__date__ = "2008/12/20 22:59:52" 
     36 
     37__developer__ = "scons" 
    3838 
    3939import os 
     
    6868    libs.append(os.environ["SCONS_LIB_DIR"]) 
    6969 
    70 local = 'scons-local-' + __version__ 
     70local_version = 'scons-local-' + __version__ 
     71local = 'scons-local' 
    7172if script_dir: 
     73    local_version = os.path.join(script_dir, local_version) 
    7274    local = os.path.join(script_dir, local) 
     75libs.append(os.path.abspath(local_version)) 
    7376libs.append(os.path.abspath(local)) 
    7477 
     
    139142        pass 
    140143    else: 
    141         while libpath: 
    142             libpath, tail = os.path.split(libpath) 
    143             if tail[:6] == "python": 
    144                 break 
    145         if libpath: 
    146             # Python library is in /usr/libfoo/python*; 
    147             # check /usr/libfoo/scons*. 
    148             prefs.append(libpath) 
     144        # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*. 
     145        libpath, tail = os.path.split(libpath) 
     146        # Split /usr/libfoo/python* to /usr/libfoo 
     147        libpath, tail = os.path.split(libpath) 
     148        # Check /usr/libfoo/scons*. 
     149        prefs.append(libpath) 
    149150 
    150151# Look first for 'scons-__version__' in all of our preference libs, 
     
    204205Verbose = 0 
    205206Readable = 0 
    206 Raw = 0 
    207207 
    208208def default_mapper(entry, name): 
     
    212212        val = None 
    213213    return str(val) 
     214 
     215def map_action(entry, name): 
     216    try: 
     217        bact = entry.bact 
     218        bactsig = entry.bactsig 
     219    except AttributeError: 
     220        return None 
     221    return '%s [%s]' % (bactsig, bact) 
    214222 
    215223def map_timestamp(entry, name): 
     
    231239    result = [] 
    232240    for i in xrange(len(bkids)): 
    233         result.append("%s: %s" % (bkids[i], bkidsigs[i])) 
     241        result.append(nodeinfo_string(bkids[i], bkidsigs[i], "        ")) 
    234242    if result == []: 
    235243        return None 
     
    237245 
    238246map_field = { 
     247    'action'    : map_action, 
    239248    'timestamp' : map_timestamp, 
    240249    'bkids'     : map_bkids, 
     
    256265 
    257266def nodeinfo_raw(name, ninfo, prefix=""): 
    258     # This does essentially what the pprint module does, 
    259     # except that it sorts the keys for deterministic output. 
     267    # This just formats the dictionary, which we would normally use str() 
     268    # to do, except that we want the keys sorted for deterministic output. 
    260269    d = ninfo.__dict__ 
    261     keys = d.keys() 
    262     keys.sort() 
     270    try: 
     271        keys = ninfo.field_list + ['_version_id'] 
     272    except AttributeError: 
     273        keys = d.keys() 
     274        keys.sort() 
    263275    l = [] 
    264276    for k in keys: 
    265         l.append('%s: %s' % (repr(k), repr(d[k]))) 
     277        l.append('%s: %s' % (repr(k), repr(d.get(k)))) 
     278    if '\n' in name: 
     279        name = repr(name) 
    266280    return name + ': {' + string.join(l, ', ') + '}' 
    267281 
    268 def nodeinfo_string(name, ninfo, prefix=""): 
    269     fieldlist = ["bsig", "csig", "timestamp", "size"] 
     282def nodeinfo_cooked(name, ninfo, prefix=""): 
     283    try: 
     284        field_list = ninfo.field_list 
     285    except AttributeError: 
     286        field_list = [] 
    270287    f = lambda x, ni=ninfo, v=Verbose: field(x, ni, v) 
    271     outlist = [name+":"] + filter(None, map(f, fieldlist)) 
     288    if '\n' in name: 
     289        name = repr(name) 
     290    outlist = [name+':'] + filter(None, map(f, field_list)) 
    272291    if Verbose: 
    273         sep = "\n    " + prefix 
    274     else: 
    275         sep = " " 
     292        sep = '\n    ' + prefix 
     293    else: 
     294        sep = ' ' 
    276295    return string.join(outlist, sep) 
    277296 
     297nodeinfo_string = nodeinfo_cooked 
     298 
    278299def printfield(name, entry, prefix=""): 
    279     if Raw: 
    280         print nodeinfo_raw(name, entry.ninfo, prefix) 
    281     else: 
    282         print nodeinfo_string(name, entry.ninfo, prefix) 
    283  
    284300    outlist = field("implicit", entry, 0) 
    285301    if outlist: 
     
    287303            print "    implicit:" 
    288304        print "        " + outlist 
    289  
    290 def printentries(entries): 
     305    outact = field("action", entry, 0) 
     306    if outact: 
     307        if Verbose: 
     308            print "    action: " + outact 
     309        else: 
     310            print "        " + outact 
     311 
     312def printentries(entries, location): 
    291313    if Print_Entries: 
    292314        for name in Print_Entries: 
     
    294316                entry = entries[name] 
    295317            except KeyError: 
    296                 sys.stderr.write("sconsign: no entry `%s' in `%s'\n" % (name, args[0])) 
     318                sys.stderr.write("sconsign: no entry `%s' in `%s'\n" % (name, location)) 
    297319            else: 
    298                 printfield(name, entry) 
     320                try: 
     321                    ninfo = entry.ninfo 
     322                except AttributeError: 
     323                    print name + ":" 
     324                else: 
     325                    print nodeinfo_string(name, entry.ninfo) 
     326                printfield(name, entry.binfo) 
    299327    else: 
    300328        names = entries.keys() 
    301329        names.sort() 
    302330        for name in names: 
    303             printfield(name, entries[name]) 
     331            entry = entries[name] 
     332            try: 
     333                ninfo = entry.ninfo 
     334            except AttributeError: 
     335                print name + ":" 
     336            else: 
     337                print nodeinfo_string(name, entry.ninfo) 
     338            printfield(name, entry.binfo) 
    304339 
    305340class Do_SConsignDB: 
     
    339374                sys.stderr.write("sconsign: %s\n" % (print_e)) 
    340375                return 
    341         except: 
     376        except KeyboardInterrupt: 
     377            raise 
     378        except cPickle.UnpicklingError: 
    342379            sys.stderr.write("sconsign: ignoring invalid `%s' file `%s'\n" % (self.dbm_name, fname)) 
     380            return 
     381        except Exception, e: 
     382            sys.stderr.write("sconsign: ignoring invalid `%s' file `%s': %s\n" % (self.dbm_name, fname, e)) 
    343383            return 
    344384 
     
    359399    def printentries(self, dir, val): 
    360400        print '=== ' + dir + ':' 
    361         printentries(cPickle.loads(val)) 
     401        printentries(cPickle.loads(val), dir) 
    362402 
    363403def Do_SConsignDir(name): 
     
    369409    try: 
    370410        sconsign = SCons.SConsign.Dir(fp) 
    371     except: 
    372         sys.stderr.write("sconsign: ignoring invalid .sconsign file `%s'\n" % name) 
     411    except KeyboardInterrupt: 
     412        raise 
     413    except cPickle.UnpicklingError: 
     414        sys.stderr.write("sconsign: ignoring invalid .sconsign file `%s'\n" % (name)) 
    373415        return 
    374     printentries(sconsign.entries) 
     416    except Exception, e: 
     417        sys.stderr.write("sconsign: ignoring invalid .sconsign file `%s': %s\n" % (name, e)) 
     418        return 
     419    printentries(sconsign.entries, args[0]) 
    375420 
    376421############################################################################## 
     
    381426Usage: sconsign [OPTIONS] FILE [...] 
    382427Options: 
    383   -b, --bsig                  Print build signature information. 
     428  -a, --act, --action         Print build action information. 
    384429  -c, --csig                  Print content signature information. 
    385430  -d DIR, --dir=DIR           Print only info about DIR. 
     
    395440""" 
    396441 
    397 opts, args = getopt.getopt(sys.argv[1:], "bcd:e:f:hirstv", 
    398                             ['bsig', 'csig', 'dir=', 'entry=', 
     442opts, args = getopt.getopt(sys.argv[1:], "acd:e:f:hirstv", 
     443                            ['act', 'action', 
     444                             'csig', 'dir=', 'entry=', 
    399445                             'format=', 'help', 'implicit', 
    400446                             'raw', 'readable', 
     
    403449 
    404450for o, a in opts: 
    405     if o in ('-b', '--bsig'): 
    406         Print_Flags['bsig'] = 1 
     451    if o in ('-a', '--act', '--action'): 
     452        Print_Flags['action'] = 1 
    407453    elif o in ('-c', '--csig'): 
    408454        Print_Flags['csig'] = 1 
     
    431477        Print_Flags['implicit'] = 1 
    432478    elif o in ('--raw',): 
    433         Raw = 1 
     479        nodeinfo_string = nodeinfo_raw 
    434480    elif o in ('-r', '--readable'): 
    435481        Readable = 1 
Note: See TracChangeset for help on using the changeset viewer.