mirror of
https://opendev.org/x/pyghmi
synced 2025-01-31 05:17:39 +00:00
Support updating from a file-like object
If passed a file-like object, be sure to use that instead of trying to open filename directly. Change-Id: I9ac28dc77aa5297ddf81d49cbd9d6cc2c07e74e6
This commit is contained in:
parent
cfceabaf78
commit
ce19aa8034
@ -704,8 +704,13 @@ class SMMClient(object):
|
||||
def update_firmware(self, filename, data=None, progress=None, bank=None):
|
||||
if progress is None:
|
||||
progress = lambda x: True
|
||||
if not data and zipfile.is_zipfile(filename):
|
||||
z = None
|
||||
if data and hasattr(data, 'read'):
|
||||
if zipfile.is_zipfile(data):
|
||||
z = zipfile.ZipFile(data)
|
||||
elif data is None and zipfile.is_zipfile(filename):
|
||||
z = zipfile.ZipFile(filename)
|
||||
if z:
|
||||
for tmpname in z.namelist():
|
||||
if tmpname.endswith('.rom'):
|
||||
filename = tmpname
|
||||
|
Loading…
x
Reference in New Issue
Block a user