def runhook(self, state, hooks=None):
        if state not in self._hooks:
            return
        if hooks is None:
            hooks = self._hooks[state]
        for (filename, data) in hooks:
            try:
                f = open(os.path.join(self.sessiondir, filename), "w")
                f.write(data)
                f.close()
            except Exception, e:
                self.warn("Error writing hook '%s': %s" % (filename, e))
            self.info("Running hook %s for state %s" % (filename, state))
            try:
                check_call(["/bin/sh", filename], cwd=self.sessiondir,
                           env=self.getenviron())
            except Exception, e:
                self.warn("Error running hook '%s' for state %s: %s" %
                          (filename, state, e))
Setup example for translation, MUST call util.setup(targets).
dataset/ETHPy150Open coreemu/core/daemon/core/session.py/Session.runhook--crossover with--dataset/ETHPy150Open anandology/pyjamas/examples/deprecated/pywebgtkbuilder/__main__.py/setup