From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id B51236DE01DD for ; Fri, 25 Oct 2019 02:57:05 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.203 X-Spam-Level: X-Spam-Status: No, score=-0.203 tagged_above=-999 required=5 tests=[AWL=-0.352, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rQUreLZjRypp for ; Fri, 25 Oct 2019 02:57:04 -0700 (PDT) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by arlo.cworth.org (Postfix) with ESMTPS id 5B8166DE0195 for ; Fri, 25 Oct 2019 02:57:04 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id g24so1389562wmh.5 for ; Fri, 25 Oct 2019 02:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version; bh=VMsGyimbBzQ5w3uGy28nM9jhuWSjeoBt0Qy82F1s6Co=; b=APfpRp7XF99bjyTYOOC0w8DqC4/aku29xcZ+3g6QB2ZHjNLaaov3Zafp7CW/nPeDnP V80onpOjrP/lrO2clfaJnyA7HtWcZRJGHYHrKyW5svWd0lzBl70TYLhP/ofd7n4ZJSp9 pZz6ZVfFBWFbU7r4kDOvcYrMmn7maFZiKNrOMdMZMdCzxMzkTY4X0kEeXBG4v+4YqJAW TiBzgv1APGGnW+2o9wpgl/tjt9G8OpGkOn4HkgDOFgBHXG8PwFar5ufXsdPxeC7tUYoL gEICTddv3lBdUF3lCGH/QZDuk5ys3x7dmi20i8spRwJ+VZzspTFklcNSBkpPmpx+u83g Y50A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:in-reply-to:references :date:message-id:mime-version; bh=VMsGyimbBzQ5w3uGy28nM9jhuWSjeoBt0Qy82F1s6Co=; b=dfh0xPQKepF3N+UdCRIadJlBE538wgxp3ovFW3iNd1XTKiGo91oXicP6iytNN0MfUD KD61UGbXU6/Lc15cXX47gkCSv5hK/Y2M4UP8XbHvmuntM6m7zAGaNucVz8bbzrVgpYHw R4rcjM+DGJfv27ssFPtZVOw342s6S7TorHBVYfQv+gEbYXjiwNb2IS45GM4K8rbRBPLH 59ut8tm/wpmfxL1pvAIHh1rSqXGZedWAsge09mEOQ7Yeje+TgGH92UPskuOiA+3ZSW8e QHnd2kD59yqWaWGjlIkkEmRDzIc+9j/SKR+8TXPgJ3u2OmpTI4pns3mN3YXcAF+QvnN/ ahEA== X-Gm-Message-State: APjAAAUcQ1W/XXVtBJOPMlfBig2rseDBsgwJoRdDiO78mYQbVvQgnTeO 414uh+m4wcDehkKmDfRPtNN09lem X-Google-Smtp-Source: APXvYqylhjwfeyaIzQjaiCY45aVOgGndp/6sWwPSLWtJbeMob0qQO0xaxKOrYznIDL7Trl5OtrN42Q== X-Received: by 2002:a05:600c:2:: with SMTP id g2mr2440383wmc.47.1571997422628; Fri, 25 Oct 2019 02:57:02 -0700 (PDT) Received: from powell.devork.be ([2a02:168:58d0::7a3]) by smtp.gmail.com with ESMTPSA id d2sm5821980wmd.2.2019.10.25.02.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 02:57:01 -0700 (PDT) Sender: Floris Bruynooghe Received: (nullmailer pid 1180 invoked by uid 1000); Fri, 25 Oct 2019 09:57:00 -0000 From: Floris Bruynooghe To: David Bremner , notmuch@notmuchmail.org Subject: Re: Python3 cffi bindings In-Reply-To: <871rv4ivvj.fsf@tethera.net> References: <20191008210312.20685-1-flub@devork.be> <8736fvbivq.fsf@tethera.net> <87zhi3a46q.fsf@tethera.net> <877e53tgvc.fsf@powell.devork.be> <878spfsj1t.fsf@tethera.net> <871rv4ivvj.fsf@tethera.net> Date: Fri, 25 Oct 2019 11:57:00 +0200 Message-ID: <87d0eljggj.fsf@powell.devork.be> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:57:05 -0000 On Tue 22 Oct 2019 at 13:32 -0300, David Bremner wrote: > David Bremner writes: > >> The LD_LIBRARY_PATH is already set by the test harness, as is PATH (to >> find notmuch). It looks like your function notmuch is not respecting >> PATH (see attached log). if I hack something like >> >> diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py >> index 1b7bbc35..ac17397c 100644 >> --- a/bindings/python-cffi/tests/conftest.py >> +++ b/bindings/python-cffi/tests/conftest.py >> @@ -31,7 +31,7 @@ def notmuch(maildir): >> accidentally do this in the unittests. >> """ >> cfg_fname = maildir.path / 'notmuch-config' >> - cmd = ['notmuch'] + list(args) >> + cmd = ['../../notmuch'] + list(args) >> print('Invoking: {}'.format(' '.join(cmd))) >> proc = subprocess.run(cmd, >> > > I think I figured it out. Your 'run' function completely overrides the > environment. But just adding PATH back seems to do the trick. I'm not > sure if this is the most idomatic change, but it works: > > diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py > index 1b7bbc35..6a81aa18 100644 > --- a/bindings/python-cffi/tests/conftest.py > +++ b/bindings/python-cffi/tests/conftest.py > @@ -33,9 +33,11 @@ def notmuch(maildir): > cfg_fname = maildir.path / 'notmuch-config' > cmd = ['notmuch'] + list(args) > print('Invoking: {}'.format(' '.join(cmd))) > proc = subprocess.run(cmd, > timeout=5, > - env={'NOTMUCH_CONFIG': str(cfg_fname)}) > + env={'PATH':os.environ["PATH"],'NOTMUCH_CONFIG': str(cfg_fname)}) > proc.check_returncode() > return run > This seems reasonable, perhaps even a "env = os.environ.copy(); env['NOTMUCH_CONFIG'] = src(cfg_fname)" is better here so that LD_LIBRARY_PATH and anything else is kept around.