Skip to content

Commit 69ffb3d

Browse files
committed
chore: pull in the Makefile cleanup
Signed-off-by: Brian Harring <[email protected]>
1 parent 8df9bdc commit 69ffb3d

File tree

2 files changed

+55
-3
lines changed

2 files changed

+55
-3
lines changed

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
PYTHON ?= python
2-
SPHINX_BUILD ?= $(PYTHON) -m sphinx.cmd.build
32

43
.PHONY: man html
54
man html:
6-
$(SPHINX_BUILD) -a -b $@ doc build/sphinx/$@
5+
doc/build.sh $@ "$$(pwd)/build/sphinx/$@"
6+
7+
html: man
8+
9+
.PHONY: docs
10+
docs: man html
711

812
.PHONY: sdist wheel
913
sdist wheel:
1014
$(PYTHON) -m build --$@
1115

16+
sdist: man
17+
18+
.PHONY: release
19+
release: sdist wheel
20+
1221
.PHONY: clean
1322
clean:
14-
$(RM) -r build/sphinx doc/api doc/generated doc/_build dist
23+
$(RM) -rf build/sphinx doc/api doc/generated doc/_build dist
1524

1625
.PHONY: format
1726
format:
1827
$(PYTHON) -m ruff format
28+
29+
.PHONY: dev-environment
30+
dev-environment:
31+
$(PYTHON) -m pip install -e .[test,doc,formatter]

doc/build.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash -e
2+
base=$(dirname "$(dirname "$(readlink -f "$0")")")
3+
4+
if [ ${#} -ne 2 ]; then
5+
echo "requires 2 arguments; the sphinx mode, and where to put the output."
6+
exit 1;
7+
fi
8+
mode="$1"
9+
output="$2"
10+
11+
12+
13+
# the point of this script is to capture sphinx output for extension
14+
# failures, and also dump that log automatically.
15+
16+
# force US; sphinx errors are localized, and we're abusing grep.
17+
export LANG=en_US.UTF-8
18+
19+
# capture stderr
20+
t=$(mktemp)
21+
if python -m sphinx.cmd.build -a -b "$mode" "$base/doc" "$output" 2>$t; then
22+
exit $?
23+
fi
24+
25+
# extract the traceback path
26+
dump=$(grep -A1 'traceback has been saved in' "$t" | tail -n1)
27+
cat < "$t"
28+
echo
29+
if [ -z "$dump" ]; then
30+
echo "FAILED auto extracting the traceback file. you'll have to do it manually"
31+
else
32+
echo
33+
echo "contents of $dump"
34+
echo
35+
cat < "$dump"
36+
rm "$t"
37+
fi
38+
39+
exit 2

0 commit comments

Comments
 (0)