Hi Ben
How can I query PyBuild for the Debian packaging build directory of
*only* the current Python interpreter version?
The trick here is to be careful what you mean by "current".
To answer your last question first, I think your mental model of what is
going on here is likely back to front. (Using codesearch.d.n to spot
that this is towncrier so that I can better understand your context..)
dh_auto_build runs pybuild once; pybuild then loops over the set of
supported interpreters. Outside of the loops being run by pybuild there
is no "current" interpreter; that means that at the time you are running
$(MAKE) there, there is no such thing as the current interpreter. At
that point, there are concepts of "supported" and "default" but not
"current". Throughout the pybuild manual 'current' is used for
replaceable parameters that are to be expanded with the 'current' value
during any loops being run by pybuild.
If you wanted to loop over all supported interpreters (i.e. py3versions
-s) then you'd set up a command in a PYBUILD_* variable and the literal
{build_dir} would be expanded by pybuild when it executed the loop;
something like PYBUILD_AFTER_BUILD could be used.
That sequence of dh_* running pybuild and then pybuild running the loop
over all supported interpreters occurs multiple times through the
package build.
However, we don't normally want to rebuild the documentation for each
supported version of the interpreter - we'd only ship one version of the
docs. We normally only build the documentation against the default
interpreter (i.e. py3versions -d).
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:]]*//' \
)
It's possible to do a dance with `py3versions -d` to extract the
variable for just the default interpreter, e.g.
pybuild --print build_dir -p $(py3versions -dv) | awk '{print $3}'
(with an extra $ in the awk command in the makefile, of course).
But even easier, all of the pipeline can be replaced with
pybuild --print build_dir --interpreter python3
The execution of sphinx is most often run as a
`execute_after_dh_auto_build` step. (I'd also not do that dh_link dance
until I was installing things from the staging output into the packages,
but that's a matter of taste.)
Related - I've wondered if the invocation of sphinx is slowly becoming
standardised enough that we could start configuring and running it
through some set of PYBUILD_SPHINX_* environment variables. I feel we
collectively spend spend more time trying to figure out how to get the
docs to build than we do the rest of the package (and I wish there was a
PEP-standardised interface to building docs and running tests).
cheers
Stuart
--
Stuart Prescott http://www.nanonanonano.net/ [email protected]
Debian Developer http://www.debian.org/ [email protected]
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7