Skip to content

Commit

Permalink
Gracefully handle missing machine info.
Browse files Browse the repository at this point in the history
  • Loading branch information
winksaville committed Oct 18, 2015
1 parent 572ce0f commit 5504c3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions authors.txt
Expand Up @@ -23,3 +23,4 @@ Marko Raatikainen
German Diago Gomez
Kyle Manna
Haakon Sporsheim
Wink Saville
5 changes: 5 additions & 0 deletions interpreter.py
Expand Up @@ -340,6 +340,11 @@ def endian_method(self, args, kwargs):
class CrossMachineInfo(InterpreterObject):
def __init__(self, cross_info):
InterpreterObject.__init__(self)
minimum_cross_info = {'cpu', 'cpu_family', 'endian', 'system'}
if set(cross_info) < minimum_cross_info:
raise InterpreterException(
'Machine info is currently {}\n'.format(cross_info) +
'but is missing {}.'.format(minimum_cross_info - set(cross_info)))
self.info = cross_info
self.methods.update({'system' : self.system_method,
'cpu' : self.cpu_method,
Expand Down

0 comments on commit 5504c3a

Please sign in to comment.