commit:     4d8f9b761973186d37cd23199da279b271a5f2e4
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Mon Dec  1 00:59:59 2025 +0000
Commit:     Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Wed Jan 21 19:00:34 2026 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=4d8f9b76

chore: pull in the Makefile cleanup

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 24cdb66..214a90f 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/sphinx doc/api doc/generated doc/_build dist
+       $(RM) -rf build/sphinx doc/api doc/generated doc/_build 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 0000000..5199737
--- /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