'Execute the hook with given args'

def execute(self, *args):

    if (len(args) != self.numparam):
        raise HookError(('Hook    %s    executed    with    wrong    number    of    args.                                                                                                                    Expected    %d.    Saw    %d.    args:    %s' % (self.name, self.numparam, len(args), args)))
    if (self.pre_exec_callback is not None):
        args = self.pre_exec_callback(*args)
    try:
        ret = subprocess.call(([self.filepath] + list(args)))
        if (ret != 0):
            if (self.post_exec_callback is not None):
                self.post_exec_callback(0, *args)
            raise HookError(('Hook    %s    exited    with    non-zero    status' % self.name))
        if (self.post_exec_callback is not None):
            return self.post_exec_callback(1, *args)
    except OSError:
        if (self.post_exec_callback is not None):
            self.post_exec_callback(0, *args)
