mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

This is a complementary fix to commit 7c552996: [ meta: remove True option to getVar calls ] it intended to remove all True option to getVar calls, but there are still some remaining. Search made with the following regex: getVar ?\((.*), True\) (From OE-Core rev: 87d03ffe03d6f01e360bfd51714be96e62506e0a) Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
# Copyright (C) 2016 Intel Corporation
|
|
# Released under the MIT license (see COPYING.MIT)
|
|
|
|
def toList(obj, obj_type, obj_name="Object"):
|
|
if isinstance(obj, obj_type):
|
|
return [obj]
|
|
elif isinstance(obj, list):
|
|
return obj
|
|
else:
|
|
raise TypeError("%s must be %s or list" % (obj_name, obj_type))
|
|
|
|
def toSet(obj, obj_type, obj_name="Object"):
|
|
if isinstance(obj, obj_type):
|
|
return {obj}
|
|
elif isinstance(obj, list):
|
|
return set(obj)
|
|
elif isinstance(obj, set):
|
|
return obj
|
|
else:
|
|
raise TypeError("%s must be %s or set" % (obj_name, obj_type))
|
|
|
|
def strToList(obj, obj_name="Object"):
|
|
return toList(obj, str, obj_name)
|
|
|
|
def strToSet(obj, obj_name="Object"):
|
|
return toSet(obj, str, obj_name)
|
|
|
|
def intToList(obj, obj_name="Object"):
|
|
return toList(obj, int, obj_name)
|
|
|
|
def dataStoteToDict(d, variables):
|
|
data = {}
|
|
|
|
for v in variables:
|
|
data[v] = d.getVar(v)
|
|
|
|
return data
|
|
|
|
def updateTestData(d, td, variables):
|
|
"""
|
|
Updates variables with values of data store to test data.
|
|
"""
|
|
for var in variables:
|
|
td[var] = d.getVar(var)
|