summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-08 16:30:52 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:31 +0100
commitac170b0c346184bd8ba2fe1d56ccb9ea003b1a40 (patch)
tree2de289d82e6b76a94a38cc3da5da69958d4f20b2
parent0d25a516b4f6f2feb4ca99d46d1958ccd9734c9b (diff)
downloadopenembedded-core-ac170b0c346184bd8ba2fe1d56ccb9ea003b1a40.tar.gz
openembedded-core-ac170b0c346184bd8ba2fe1d56ccb9ea003b1a40.tar.bz2
openembedded-core-ac170b0c346184bd8ba2fe1d56ccb9ea003b1a40.zip
bb.event: NotHandled and Handled are on the way out
(Bitbake rev: ed35b30f8e09b0bfc15102fa6483c55d6b7d61de) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--bitbake/doc/manual/usermanual.xml4
-rw-r--r--bitbake/lib/bb/event.py8
2 files changed, 7 insertions, 5 deletions
diff --git a/bitbake/doc/manual/usermanual.xml b/bitbake/doc/manual/usermanual.xml
index 6424a7ebd9..bd44a69e3f 100644
--- a/bitbake/doc/manual/usermanual.xml
+++ b/bitbake/doc/manual/usermanual.xml
@@ -215,13 +215,11 @@ addtask printdate before do_build</screen></para>
<para>BitBake allows to install event handlers. Events are triggered at certain points during operation, such as, the beginning of operation against a given .bb, the start of a given task, task failure, task success, et cetera. The intent was to make it easy to do things like email notifications on build failure.</para>
<para><screen>addhandler myclass_eventhandler
python myclass_eventhandler() {
- from bb.event import NotHandled, getName
+ from bb.event import getName
from bb import data
print "The name of the Event is %s" % getName(e)
print "The file we run for is %s" % data.getVar('FILE', e.data, True)
-
- return NotHandled
}
</screen></para><para>
This event handler gets called every time an event is triggered. A global variable <varname>e</varname> is defined. <varname>e</varname>.data contains an instance of bb.data. With the getName(<varname>e</varname>)
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index f49f71cf71..c1c6a36c9d 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -23,6 +23,7 @@ BitBake build tools.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os, re, sys
+import warnings
import bb.utils
import pickle
@@ -38,7 +39,7 @@ class Event:
self.pid = worker_pid
NotHandled = 0
-Handled = 1
+Handled = 1
Registered = 10
AlreadyRegistered = 14
@@ -59,7 +60,10 @@ def fire_class_handlers(event, d):
if type(h).__name__ == "code":
locals = {"e": event}
bb.utils.simple_exec(h, locals)
- bb.utils.better_eval("tmpHandler(e)", locals)
+ ret = bb.utils.better_eval("tmpHandler(e)", locals)
+ if ret is not None:
+ warnings.warn("Using Handled/NotHandled in event handlers is deprecated",
+ DeprecationWarning, stacklevel = 2)
else:
h(event)
del event.data