Article View: linux.debian.maint.python
Article #60Interrogate PyBuild for build directory of *only* the current Python interpreter version
From: Ben Finney
Date: Fri, 06 Nov 2026 00:30
Date: Fri, 06 Nov 2026 00:30
58 lines
4048 bytes
4048 bytes
Howdy,
How can I query PyBuild for the Debian packaging build directory of
*only* the current Python interpreter version?
The assumption here is that PyBuild executes multiple times, once for
each installed Python interpreter version, and each time has a single
answer to “what is the build directory filesystem path”. If that
assumption is incorrect, I have misunderstood the PyBuild manual page,
and I still want to know how to hook into PyBuild and get at that
information.
In ‘debian/rules’ I need to set the ‘PYTHONPATH’ for the Sphinx
documentation build system:
=====
$(MAKE) \
PYTHONPATH="${pybuild_computed_build_dir}" \
${SPHINX_MAKE_OPTS} \
html man
=====
That ‘pybuild_computed_build_dir’ is set earlier with this assignment:
=====
pybuild_computed_build_dir = $(shell \
pybuild --print build_dir \
| cut -d ':' -f 2 \
| sed -e 's/^[[:space:]]*//' \
)
=====
Which works fine when PyBuild finds only one Python interpreter. When
there are multiple (normal during a Debian development cycle), PyBuild
reports *all* the build directories, instead of just the current one
during the build:
=====
$ pybuild --print build_dir
python3.15 build_dir: /[…]/.pybuild/cpython3_3.15/build
python3.14 build_dir: /[…]/.pybuild/cpython3_3.14/build
=====
which does not allow me to get just *the one* build directory being used
for the current package. The ‘PYTHONPATH’ variable is naively set as a
concatenation of those two paths, which is invalid.
How can I get just the build directory PyBuild understands for the
current Python interpreter being used to build? Or, if I misunderstand
what PyBuild is doing (the manual page doesn't help me here), how can I
hook into PyBuild the way I need to, to get the single correct build
directory value each time?
--
\ “Most people are other people. Their thoughts are someone |
`\ else’s opinions, their lives a mimicry, their passions a |
_o__) quotation.” —Oscar Wilde, _De Profundis_, 1897 |
Ben Finney
Technical Details
Message-ID:
<NWg09-a5eH-3@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod From: Ben Finney <bignose@debian.org> Newsgroups: linux.debian.maint.python Subject: Interrogate PyBuild for build directory of *only* the current Python interpreter version Date: Fri, 06 Nov 2026 01:30:01 +0100 Message-ID: <NWg09-a5eH-3@gated-at.bofh.it> X-Mailbox-Line: From debian-python-request@lists.debian.org Fri Nov 6 00:20:44 2026 Old-Return-Path: <debian-python@m.gmane-mx.org> X-Amavis-Spam-Status: No, score=-1.75 tagged_above=-10000 required=5.3 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25] autolearn=no autolearn_force=no X-Policyd-Weight: using cached result; rate:hard: -4.6 X-Greylist: delayed 327 seconds by postgrey-1.37 at bendel; Fri, 06 Nov 2026 00:20:34 UTC X-Injected-Via-Gmane: http://gmane.org/ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:V8zPudNkx3AwIROMl9k9d2WNF2w= X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney <bignose+hates-spam@benfinney.id.au> X-Mailing-List: <debian-python@lists.debian.org> archive/latest/24180 List-ID: <debian-python.lists.debian.org> List-URL: <https://lists.debian.org/debian-python/> List-Archive: https://lists.debian.org/msgid-search/87se1eq0hm.fsf@benfinney.id.au Approved: robomod@news.nic.it Lines: 58 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Fri, 06 Nov 2026 11:15:01 +1100 X-Original-Message-ID: <87se1eq0hm.fsf@benfinney.id.au>