pypi2deb icon indicating copy to clipboard operation
pypi2deb copied to clipboard

sphinx fragment builds packages twice

Open llimeht opened this issue 3 years ago • 1 comments

The debian/rules fragment for building documentation with sphinx is as follows:

override_dh_auto_build-indep:
	dh_auto_build -i
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd {{docs.sphinx_dir}} && \
	PYTHONPATH=$(CURDIR) http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	sphinx-build -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
endif

This fragment will cause the following sequence from dh:

  • debian/rules override_dh_auto_build-indep (which calls dh_auto_build -i)
  • dh_auto_build -N<python-foo-doc> (which calls dh_auto_build)

Since pybuild doesn't know how to build only the indep or arch-specific packages, dh_auto_build -i doesn't actually build only a fraction of the packages but builds everything. The result is that the source actually gets built twice in this sequence; for some packages that's tediously long and for some packages, that can cause a FTBFS.

From debhelper 12.8 (buster-backports and newer), this fragment can be simplified with:

execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
[...]

With this change, dh_auto_build is not overridden and is only called once; for a build that will produce the doc package, sphinx will be also run.

I'd also suggest pointing PYTHONPATH to the pybuild {build_dir} so that compiled extensions are available and modules are always importable.

llimeht avatar Dec 17 '21 00:12 llimeht

a fix for this was released with https://tracker.debian.org/news/1343951/accepted-pypi2deb-320220707-source-into-unstable/ and so this issue can be closed

sandrotosi avatar Jul 08 '22 03:07 sandrotosi