Deleted Added
sdiff udiff text old ( 5467:6d9df90d70d7 ) new ( 5618:1abb23c038d5 )
full compact
1# Copyright (c) 2005-2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 14 unchanged lines hidden (view full) ---

23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
29import sys
30
31from attrdict import attrdict, optiondict
32from misc import crossproduct, flatten
33
34class Data(object):
35 def __init__(self, name, desc, **kwargs):
36 self.name = name
37 self.desc = desc
38 self.__dict__.update(kwargs)
39
40 def update(self, obj):
41 if not isinstance(obj, Data):
42 raise AttributeError, "can only update from Data object"
43
44 for k,v in obj.__dict__.iteritems():
45 if not k.startswith('_'):
46 self.__dict__[k] = v
47 if hasattr(self, 'system') and hasattr(obj, 'system'):
48 if self.system != obj.system:
49 raise AttributeError, \
50 "conflicting values for system: '%s'/'%s'" % \
51 (self.system, obj.system)
52
53 def printinfo(self):
54 if self.name:

--- 33 unchanged lines hidden (view full) ---

88 yield key
89
90 def optiondict(self):
91 result = optiondict()
92 for key in self:
93 result[key] = self[key]
94 return result
95
96 def __str__(self):
97 return self.name
98
99class Job(Data):
100 def __init__(self, options):
101 super(Job, self).__init__('', '')
102
103 config = options[0]._config

--- 282 unchanged lines hidden (view full) ---

386 else:
387 raise AttributeError, \
388 "Could not find file '%s'" % jobfile
389
390 data = {}
391 execfile(filename, data)
392 if 'conf' not in data:
393 raise ImportError, 'cannot import name conf from %s' % jobfile
394 conf = data['conf']
395 import jobfile
396 if not isinstance(conf, Configuration):
397 raise AttributeError, \
398 'conf in jobfile: %s (%s) is not type %s' % \
399 (jobfile, type(conf), Configuration)
400 return conf
401
402def main(conf=None):
403 import sys
404
405 usage = 'Usage: %s [-b] [-c] [-v] <jobfile>' % sys.argv[0]
406
407 try:
408 import getopt
409 opts, args = getopt.getopt(sys.argv[1:], '-bcv')
410 except getopt.GetoptError:
411 sys.exit(usage)
412
413 both = False
414 checkpoint = False

--- 36 unchanged lines hidden ---