Handle dict values in kernel and dtb

This commit is contained in:
Carl D. Roth
2016-05-02 13:00:02 -07:00
parent a5e443274f
commit 672e8d656d

View File

@@ -20,15 +20,22 @@ class Image(object):
self.entry = None self.entry = None
self.os = None self.os = None
if type(data) == str:
if ',' in data: if ',' in data:
# Shorthand for tuple specifier pkg, fname = [x.strip() for x in data.split(',')]
data = tuple([ x.strip() for x in data.split(',') ]) else:
pkg, fname = None, data
elif type(data) == list:
pkg, fname = data
elif type(data) == dict:
fname = data['=']
pkg = data.get('package', None)
else:
raise ValueError("invalid image specifier: %s" % repr(data))
if(isinstance(data, tuple)): if pkg is not None:
# cmd = ('onlpm', '--quiet', '--find-file', pkg, fname,)
# The data specifies an ONLPM (package,file) pair. self.data = subprocess.check_output(cmd).strip()
#
self.data = subprocess.check_output("onlpm --quiet --find-file %s %s" % data, shell=True).strip()
else: else:
self.data = data self.data = data