commit:     9e3fccf6e5de60bb0c9c965fbb889e99b82cfc55
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Mon Dec  1 00:45:37 2025 +0000
Commit:     Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Mon Dec  1 00:45:37 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9e3fccf6

chore: pull in Makefile fixes

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>

 Makefile     | 19 ++++++++++++++++---
 doc/build.sh | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 63b08eea..2efc1390 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,31 @@
 PYTHON ?= python
-SPHINX_BUILD ?= $(PYTHON) -m sphinx.cmd.build
 
 .PHONY: man html
 man html:
-       $(SPHINX_BUILD) -a -b $@ doc build/sphinx/$@
+       doc/build.sh $@ "$$(pwd)/build/sphinx/$@"
+
+html: man
+
+.PHONY: docs
+docs: man html
 
 .PHONY: sdist wheel
 sdist wheel:
        $(PYTHON) -m build --$@
 
+sdist: man
+
+.PHONY: release
+release: sdist wheel
+
 .PHONY: clean
 clean:
-       $(RM) -r build doc/man/pkgcheck doc/generated dist
+       $(RM) -rf build doc/man/pkgcheck doc/generated dist
 
 .PHONY: format
 format:
        $(PYTHON) -m ruff format
+
+.PHONY: dev-environment
+dev-environment:
+       $(PYTHON) -m pip install -e .[test,doc,formatter]

diff --git a/doc/build.sh b/doc/build.sh
new file mode 100755
index 00000000..5199737b
--- /dev/null
+++ b/doc/build.sh
@@ -0,0 +1,39 @@
+#!/bin/bash -e
+base=$(dirname "$(dirname "$(readlink -f "$0")")")
+
+if [ ${#} -ne 2 ]; then
+    echo "requires 2 arguments; the sphinx mode, and where to put the output."
+    exit 1;
+fi
+mode="$1"
+output="$2"
+
+
+
+# the point of this script is to capture sphinx output for extension
+# failures, and also dump that log automatically.
+
+# force US; sphinx errors are localized, and we're abusing grep.
+export LANG=en_US.UTF-8 
+
+# capture stderr
+t=$(mktemp)
+if python -m sphinx.cmd.build -a -b "$mode" "$base/doc" "$output" 2>$t; then
+    exit $?
+fi
+
+# extract the traceback path
+dump=$(grep -A1 'traceback has been saved in' "$t" | tail -n1)
+cat < "$t"
+echo
+if [ -z "$dump" ]; then
+    echo "FAILED auto extracting the traceback file.  you'll have to do it 
manually"
+else
+    echo
+    echo "contents of $dump"
+    echo
+    cat < "$dump"
+    rm "$t"
+fi
+
+exit 2
\ No newline at end of file

Reply via email to