summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>2016-07-04 14:54:53 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-07 13:38:13 +0100
commit4252ec78a491f2828fb39d2087ace6e4c1339414 (patch)
treee97e2f228a2457e0b852b381a3fea07ee02324b2 /scripts/lib
parent71bc7fd8ce9ba4db13ca82f56ff7d8ab8b2a279f (diff)
downloadpoky-4252ec78a491f2828fb39d2087ace6e4c1339414.tar.gz
scripts/lib/bsp/engine.py: Add error message for wrong input file
Format of properties file is expected to be a simple json detailing properties, if this format fails an exception is thrown. This patch adds a graceful error message to the case when the properties file has a wrong format. [YOCTO #9750] (From meta-yocto rev: 7e543aa19d0d4b2112e6316783fb31b76df3493e) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/bsp/engine.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 85f095ebcb..760efc7a60 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -1547,11 +1547,13 @@ def yocto_common_create(machine, target, scripts_path, layer_output_dir, codedum
1547 if properties_file: 1547 if properties_file:
1548 try: 1548 try:
1549 infile = open(properties_file, "r") 1549 infile = open(properties_file, "r")
1550 properties = json.load(infile)
1550 except IOError: 1551 except IOError:
1551 print("Couldn't open properties file %s for reading, exiting" % properties_file) 1552 print("Couldn't open properties file %s for reading, exiting" % properties_file)
1552 sys.exit(1) 1553 sys.exit(1)
1553 1554 except ValueError:
1554 properties = json.load(infile) 1555 print("Wrong format on properties file %s, exiting" % properties_file)
1556 sys.exit(1)
1555 1557
1556 if properties_str and not properties: 1558 if properties_str and not properties:
1557 properties = json.loads(properties_str) 1559 properties = json.loads(properties_str)