[oe-commits] Chris Larson : oe.types: allow specifying the number base for integer

git version control git at git.openembedded.org
Thu Jan 13 16:02:13 UTC 2011


Module: openembedded.git
Branch: master
Commit: 9e6a8f0000fcceb7d3d3992a307323a4563ee8c2
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=9e6a8f0000fcceb7d3d3992a307323a4563ee8c2

Author: Chris Larson <chris_larson at mentor.com>
Date:   Thu Jan 13 08:42:01 2011 -0700

oe.types: allow specifying the number base for integer

Signed-off-by: Chris Larson <chris_larson at mentor.com>

---

 lib/oe/_types.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/oe/_types.py b/lib/oe/_types.py
index b36060f..b9eb2d2 100644
--- a/lib/oe/_types.py
+++ b/lib/oe/_types.py
@@ -82,6 +82,10 @@ def boolean(value):
         return False
     raise ValueError("Invalid boolean value '%s'" % value)
 
-def integer(value):
-    """OpenEmbedded 'integer' type"""
-    return int(value)
+def integer(value, numberbase=10):
+    """OpenEmbedded 'integer' type
+
+    Defaults to base 10, but this can be specified using the optional
+    'numberbase' flag."""
+
+    return int(value, int(numberbase))





More information about the Openembedded-commits mailing list