]> code.ossystems Code Review - openembedded-core.git/commitdiff
Use __import__ for the ui rather than exec
authorChris Larson <chris_larson@mentor.com>
Fri, 9 Apr 2010 20:25:58 +0000 (13:25 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Fri, 2 Jul 2010 14:41:31 +0000 (15:41 +0100)
(Bitbake rev: 7d00bab300961431f9960cf6759966f608580bc0)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/bin/bitbake

index cef59c9117575d2bcfe2e16f47a08cd77b70bb42..c2088d93207d5c71c07e6a8c8373ad488ae74665 100755 (executable)
@@ -181,12 +181,12 @@ Default BBFILES are the .bb files in the current directory.""" )
         ui = "knotty"
 
     try:
-            # Dynamically load the UI based on the ui name. Although we
-            # suggest a fixed set this allows you to have flexibility in which
-            # ones are available.
-            exec "from bb.ui import " + ui
-            exec "return_value = " + ui + ".init(serverConnection.connection, serverConnection.events)"
-    except ImportError:
+        # Dynamically load the UI based on the ui name. Although we
+        # suggest a fixed set this allows you to have flexibility in which
+        # ones are available.
+        uimodule = __import__("bb.ui", fromlist=[ui])
+        return_value = getattr(uimodule, ui).init(serverConnection.connection, serverConnection.events)
+    except AttributeError:
         print "FATAL: Invalid user interface '%s' specified. " % ui
         print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
     except Exception, e: