From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MCbAOR5qfmEpNAEAgWs5BA (envelope-from ) for ; Sun, 31 Oct 2021 11:04:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id kEBUNR5qfmHgcQAAbx9fmQ (envelope-from ) for ; Sun, 31 Oct 2021 10:04:14 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4BBDAE44A for ; Sun, 31 Oct 2021 11:04:14 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 94CBE1FCD3; Sun, 31 Oct 2021 06:04:09 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 1748E1F57C for ; Sun, 31 Oct 2021 06:03:59 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 5F0835FC42; Sun, 31 Oct 2021 06:03:59 -0400 (EDT) Received: (nullmailer pid 1697392 invoked by uid 1000); Sun, 31 Oct 2021 10:03:58 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] python-cffi: fix out-of-tree build Date: Sun, 31 Oct 2021 07:03:54 -0300 Message-Id: <20211031100354.1697379-1-david@tethera.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Message-ID-Hash: JZDBJVMEQXAPWF5DV7IAPAYYBGUHLG4N X-Message-ID-Hash: JZDBJVMEQXAPWF5DV7IAPAYYBGUHLG4N X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635674654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=PsXQxf2rsIM4Nvy4wK7AQG3bfyJtnrMPpLM5JX02KeI=; b=ifeeFchIUDB3c4PJfspRNHyEeDL+/LLbHemgoae11b91Gj1rPSs4H3T6egD+nOU9xvyVlT oFah/P7dSNkR0zDwi+7TuqxBKNFE59LCgwupkDmmwp/KXZzGWogyVPvIg/6G9Dr9thcXbn Cew8o/vAan/FWMWuGk97lw8LJjUClq+WxeBJM4FupGDamI8P3yh8oHKCAz4luIzqq6B+v5 ZEpSgheuRczu3dMnJgok/TdL9pQD5f+OLWW1knK/13hg7KYBbssvk/QbT8MBINCW/X9obt Uu+tLiQiQUXwXPKVjs3k3uQ6SSOE1iSnnMuiDWQUCF1znAYRVP54mv6O5bp2Hg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635674654; a=rsa-sha256; cv=none; b=fFAKwDC8xW0UB/xz1SbfCGUUFfL5PeuOXqllN8XUNfQxg/B9nELYRberjaclbqvb4T+9H3 SeOXe+xViku9wrRwcm+8OGaKK1JtAP5dtg8WjlfjoHeSxLXs9TQk4K1FR/9920GBe/yOdc 3cCxowA6XqlDfv9Di2tlgwpWnAFOslz/6SoJWZsaZ65c8OGLB4/NvCF4mriGMk7vLJ+cyD Bm7iza6Rf94c3MGUqji26CaQGeXSo4l8Q21q8LaV+iutR1uHm9HSKS3z5MwIP8ZA8Ahvii tg+16TLLcTVa4g+QDta0HxtPDhP+IVrWei+opVlzSXYUUE9B9KbkTXBCcKpSSw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.15 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 4BBDAE44A X-Spam-Score: -1.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: Tuow8xOcDJ3B The main idea is to replace the hack of copying version.txt into the bindings source with a generated _notmuch_config.py file. This will mean that the bindings only build after configuring and building notmuch itself. Given those constraints, "pip install ." should work. --- Makefile.local | 1 - bindings/python-cffi/notmuch2/_build.py | 6 +++--- bindings/python-cffi/setup.py | 3 ++- bindings/python-cffi/version.txt | 1 - configure | 9 +++++++++ 5 files changed, 14 insertions(+), 6 deletions(-) delete mode 100644 bindings/python-cffi/version.txt diff --git a/Makefile.local b/Makefile.local index e12b94cd..10fb9908 100644 --- a/Makefile.local +++ b/Makefile.local @@ -54,7 +54,6 @@ update-versions: sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \ -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \ ${PV_FILE} - cp version.txt bindings/python-cffi # We invoke make recursively only to force ordering of our phony # targets in the case of parallel invocation of make (-j). diff --git a/bindings/python-cffi/notmuch2/_build.py b/bindings/python-cffi/notmuch2/_build.py index 24df939e..ef40020b 100644 --- a/bindings/python-cffi/notmuch2/_build.py +++ b/bindings/python-cffi/notmuch2/_build.py @@ -1,5 +1,5 @@ import cffi - +from _notmuch_config import * ffibuilder = cffi.FFI() ffibuilder.set_source( @@ -16,8 +16,8 @@ ffibuilder.set_source( #ERROR libnotmuch version < 5.1 not supported #endif """, - include_dirs=['../../lib'], - library_dirs=['../../lib'], + include_dirs=[NOTMUCH_INCLUDE_DIR], + library_dirs=[NOTMUCH_LIB_DIR], libraries=['notmuch'], ) ffibuilder.cdef( diff --git a/bindings/python-cffi/setup.py b/bindings/python-cffi/setup.py index cda52338..55fb2d24 100644 --- a/bindings/python-cffi/setup.py +++ b/bindings/python-cffi/setup.py @@ -1,6 +1,7 @@ import setuptools +from _notmuch_config import * -with open('version.txt') as fp: +with open(NOTMUCH_VERSION_FILE) as fp: VERSION = fp.read().strip() setuptools.setup( diff --git a/bindings/python-cffi/version.txt b/bindings/python-cffi/version.txt deleted file mode 100644 index 61d2f357..00000000 --- a/bindings/python-cffi/version.txt +++ /dev/null @@ -1 +0,0 @@ -0.34 diff --git a/configure b/configure index 6c3a38f1..69173648 100755 --- a/configure +++ b/configure @@ -1579,6 +1579,15 @@ EOF printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)" } > sphinx.config +# construct notmuch_build.py +cat > bindings/python-cffi/_notmuch_config.py <