[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pybuild sphinxdoc and extensions



Piotr Ożarowski wrote:

> last one, I promise:
>
>   override_dh_auto_build:
>  	dh_auto_build
>  	pybuild --build -i python3 -s custom --build-args 'make -C {dir}/doc html'

Piotr, thanks for all the funny versions…

Unfortunately, most of Piotr’s suggestions do not seem to work (I tried
for several hours).  In the end, I’m using the debian/rules that is
pasted at the bottom.  Specifically, I encountered the following problems:

• In order to create the doc package only when building for
  binary-indep, Piotr’s suggestion of using the clause ifeq (,$(filter
  nodoc,$(DEB_BUILD_OPTIONS))) does not work: the doc package gets built
  always.

• Using the override_dh_auto_install target instead of
  override_dh_installdocs as Piotr suggested in his first message does
  not work: the documentation build scripts cannot import kwant.  It
  seems that when dh_auto_install is run the directory to which
  PYTHONPATH (see below) is set, is empty.

• The suggestion from Piotr’s fourth message was to use the target
  override_dh_auto_build and set PYTHONPATH to `pybuild --build
  -i python3 -s custom --build-args 'echo {build_dir}'`.  This evaluates
  to (…)/.pybuild/python3_3.4/build but that directory is empty.

• Finally, Piotr’s last suggestion (to use pybuild) also doesn’t work:
  the import of kwant fails.

I’m grateful for any suggestions.  (Mostly out of curiosity, since the
below debian/rules seems to work well.)

If anyone would like to play with these things, the packaging git
repository of my project can be found here:
https://gitlab.kwant-project.org/kwant/debian-kwant
It also needs:
https://gitlab.kwant-project.org/kwant/debian-tinyarray

Cheers,
Christoph

****************************************************************
#!/usr/bin/make -f

# export DH_VERBOSE = 1
export PYBUILD_NAME = kwant

%:
        dh $@ --with python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_clean:
        dh_auto_clean
        cd doc && $(MAKE) realclean
        rm -rf tutorial build.conf

override_dh_compress-indep:
        dh_compress -X.py

#  The default locale with pbuilder is C.  This makes Sphinx fail wit
#  UFT-8-encoded input files.  As a workaround, we set LC_ALL manually.  If
#  this is a bug in Sphinx, we may be able to remove this one day.

# Make documentation only if needed.
ifneq "$(shell dh_listpackages | grep -- -doc)" ""
PY3VER = $(shell python3 --version | cut -d' ' -f2 | cut -d. -f1,2)
override_dh_installdocs:
        PYTHONPATH=$(CURDIR)/debian/python3-kwant/usr/lib/python$(PY3VER)/dist-packages \
        LC_ALL=C.UTF-8 $(MAKE) -C doc html
        dh_installdocs
endif
****************************************************************


Reply to: