diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-04-09 13:25:58 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-04-09 13:25:58 -0700 |
commit | 7d00bab300961431f9960cf6759966f608580bc0 (patch) | |
tree | b37d3c4656b552895c1e43c583ad7d7f535244f8 /bin | |
parent | 50b7b817d418532583da3bad62a36fcefe3637a2 (diff) | |
download | bitbake-7d00bab300961431f9960cf6759966f608580bc0.tar.gz |
Use __import__ for the ui rather than exec
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bitbake | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/bitbake b/bin/bitbake index a5b94bab2..1bcf8134c 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -178,12 +178,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: |