summaryrefslogtreecommitdiff
path: root/cxmanage_api/image.py
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2013-11-19 17:06:33 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2013-11-19 17:06:33 +0000
commit54116d3c486ed7aa49f284e4cad9e6e7c293bea6 (patch)
treefa32a75ebba262def85af97cc34a7db69bc69034 /cxmanage_api/image.py
parent7087e92d40310d9bb6c8b4a6bb1baf7c3b73bee7 (diff)
parent4da2f9c7eaa95ebf357eeca3a497b6a206675ef8 (diff)
downloadcxmanage-54116d3c486ed7aa49f284e4cad9e6e7c293bea6.tar.gz
Merge tag 'v0.10.2' into baserock/morphbaserock/morph
v0.10 post-release tag for pyinstaller support
Diffstat (limited to 'cxmanage_api/image.py')
-rw-r--r--cxmanage_api/image.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/cxmanage_api/image.py b/cxmanage_api/image.py
index 23642c4..8f3011a 100644
--- a/cxmanage_api/image.py
+++ b/cxmanage_api/image.py
@@ -1,4 +1,7 @@
-# Copyright (c) 2012, Calxeda Inc.
+"""Calxeda: image.py"""
+
+
+# Copyright (c) 2012-2013, Calxeda Inc.
#
# All rights reserved.
#
@@ -38,7 +41,7 @@ from cxmanage_api.simg import valid_simg, get_simg_contents
from cxmanage_api.cx_exceptions import InvalidImageError
-class Image:
+class Image(object):
"""An Image consists of: an image type, a filename, and SIMG header info.
>>> from cxmanage_api.image import Image
@@ -62,6 +65,7 @@ class Image:
"""
+ # pylint: disable=R0913
def __init__(self, filename, image_type, simg=None, daddr=None,
skip_crc32=False, version=None):
"""Default constructor for the Image class."""
@@ -114,8 +118,8 @@ class Image:
skip_crc32=self.skip_crc32, align=align,
version=self.version)
filename = temp_file()
- with open(filename, "w") as f:
- f.write(simg)
+ with open(filename, "w") as file_:
+ file_.write(simg)
# Make sure the simg was built correctly
if (not valid_simg(open(filename).read())):
@@ -152,7 +156,7 @@ class Image:
:rtype: boolean
"""
- if (self.type == "SOC_ELF"):
+ if (self.type == "SOC_ELF" and not self.simg):
try:
file_process = subprocess.Popen(["file", self.filename],
stdout=subprocess.PIPE)