diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-01-13 08:42:13 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2011-01-13 08:58:46 -0700 |
commit | 823c6df67e743e90e8e7e2a5e5a79fe68b24e9e6 (patch) | |
tree | ba12c3c6d912e50d561dfba239cf03aa9621377d /lib/oe | |
parent | 9e6a8f0000fcceb7d3d3992a307323a4563ee8c2 (diff) | |
download | openembedded-823c6df67e743e90e8e7e2a5e5a79fe68b24e9e6.tar.gz |
oe.types: add floating point type
Optional flags:
'fromhex': if set to a true value (obeying the same rules as for the boolean
type), your string value is in base 16, not base 10
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/oe')
-rw-r--r-- | lib/oe/_types.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/oe/_types.py b/lib/oe/_types.py index b9eb2d2b86..ea31cf4219 100644 --- a/lib/oe/_types.py +++ b/lib/oe/_types.py @@ -89,3 +89,16 @@ def integer(value, numberbase=10): 'numberbase' flag.""" return int(value, int(numberbase)) + +_float = float +def float(value, fromhex='false'): + """OpenEmbedded floating point type + + To use this type, set the type flag to 'float', and optionally set the + 'fromhex' flag to a true value (obeying the same rules as for the + 'boolean' type) if the value is in base 16 rather than base 10.""" + + if boolean(fromhex): + return _float.fromhex(value) + else: + return _float(value) |