From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 912 invoked by alias); 25 Oct 2014 22:57:51 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 898 invoked by uid 89); 25 Oct 2014 22:57:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yh0-f43.google.com Received: from mail-yh0-f43.google.com (HELO mail-yh0-f43.google.com) (209.85.213.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 22:57:49 +0000 Received: by mail-yh0-f43.google.com with SMTP id z6so2978467yhz.30 for ; Sat, 25 Oct 2014 15:57:47 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.236.11.137 with SMTP id 9mr4811437yhx.170.1414277867153; Sat, 25 Oct 2014 15:57:47 -0700 (PDT) Received: by 10.170.140.214 with HTTP; Sat, 25 Oct 2014 15:57:47 -0700 (PDT) In-Reply-To: References: Date: Sat, 25 Oct 2014 22:57:00 -0000 Message-ID: Subject: Re: Define python hooks From: Doug Evans To: nojhan Cc: gdb Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00097.txt.bz2 On Sat, Oct 25, 2014 at 2:08 AM, nojhan wrote: > Hello, > > I'm currently using several of hook-* and hookpost-* functions with > shell commands. > I was wondering if there was a way to define such hooks in pure python. > > For instance, I would like to import a module at startup and use it > across all the hooks to manipulate the output of the hooked commands. Hi. While one can't directly define hooks in python, one can still invoke python from hooks. E.g. define hookpost-step python ... python code ... end end