registers this build target (exclusively) with a given context

def register_with_context(self, myname, context):
        """ registers this build target (exclusively) with a given context """

        if self.context is not None:
            raise Exception("attempted to register BuildTarget with multiple "
                            "BuildContexts")

        context.register_task(myname, self)
        self._name = myname
        self.context = context

        for key in self.data_dependencies:
            if type(self.data_dependencies[key]) is DeferredDependency:
                self.data_dependencies[key].parent  = myname
                self.data_dependencies[key].context = context
                for tnmame in self.data_dependencies[key].target_names:
                    context.register_dependency(tnmame, myname)