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

Reply via email to