Control: tags 1010316 +patch

On 2022-04-28, Chris Lamb wrote:
> The cli.html documentation file contains the following:
>
>   System Message: ERROR/6 
> (/build/python-cai-AL0f0J/python-cai-1.0.2/docs/cli.rst, line 4)
>
>   Command ['CAI', '--help'] failed: [Errno 2] No such file or directory: 'CAI'
>
> ... instead of, presumably, the output of calling --help. This is
> actually affecting reproducibility. I can't quite find the right
> combination of setting PYTHONPATH and PATH to get this to work,
> unfortunately...

By coincidence, I happened to be working on this about the same time,
and eventually figured out that "CAI" did not exist after dh_auto_build,
but noticed it did exist during the dh_installman phase, as it was used
with help2man to generate manpages.

Through a lot of trial and error, I eventually moved it just before
dh_installdocs and specified PATH and PYTHONPATH and it appears to
work. There may be a better place to put it, but this appears to
work. Patch attached!

I also had success with PYTHONPATH=$(CURDIR) instead of PYTHONPATH=.. if
that is somehow more ideal.


live well,
  vagrant
From 7a6e146bdf6472a17ffa8d82348f6633fc750171 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Thu, 28 Apr 2022 23:03:04 +0000
Subject: [PATCH] debian/rules: Move documentation building phase before
 running dh_installdocs, and specify PATH and PYTHONPATH.

The "CAI" binary is not available after dh_auto_build, so run in the
dh_installdocs target instead.

Specify PYTHONPATH=.. as sphinx is run from the docs subdir.
---
 debian/rules | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/debian/rules b/debian/rules
index 93b614c..57ded76 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,15 +10,13 @@ export https_proxy = 127.0.0.1:9
 %:
 	dh $@ --buildsystem pybuild --with python3,sphinxdoc
 
-override_dh_auto_build:
-	dh_auto_build
-	PYTHONPATH=. python3 -m sphinx -N -bhtml docs build/html
-	find build/html -name .doctrees | xargs --no-run-if-empty rm -rf
-
 override_dh_auto_test:
 	dh_auto_test -- --test-pytest
 
 override_dh_installdocs:
+	PATH=$(CURDIR)/debian/python3-cai/usr/bin:$(PATH) PYTHONPATH=.. python3 -m sphinx -N -bhtml docs build/html
+	find build/html -name .doctrees | xargs --no-run-if-empty rm -rf
+
 	dh_installdocs
 	dh_installdocs -p python-cai-doc --doc-main-package python3-cai build/html
 
-- 
2.36.0

Attachment: signature.asc
Description: PGP signature

Reply via email to