Skip to content

Commit 8176553

Browse files
committed
verify_reference_index now checks that all reference .rst fiiles also exists as a module
1 parent c0e3dd5 commit 8176553

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed
Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
11
#!/bin/bash
22

3+
RETVAL=0
4+
35
verify_index() {
6+
retval=0
7+
for refdir in $*; do
8+
verify_modules_in_index "$refdir/index.rst"
9+
verify_files "$refdir"
10+
done
11+
return $RETVAL
12+
}
13+
14+
verify_files() {
15+
for path in $1/*.rst; do
16+
rst=${path##*/}
17+
modname=${rst%*.rst}
18+
if [ $modname != "index" ]; then
19+
modpath=$(echo $modname | tr . /)
20+
pkg="$modpath/__init__.py"
21+
mod="$modpath.py"
22+
if [ ! -f "$pkg" ]; then
23+
if [ ! -f "$mod" ]; then
24+
echo "*** NO MODULE $modname for reference '$path'"
25+
RETVAL=1
26+
fi
27+
fi
28+
fi
29+
done
30+
}
31+
32+
verify_modules_in_index() {
433
modules=$(grep "celery." "$1" | \
534
perl -ple's/^\s*|\s*$//g;s{\.}{/}g;')
6-
retval=0
735
for module in $modules; do
836
if [ ! -f "$module.py" ]; then
937
if [ ! -f "$module/__init__.py" ]; then
10-
echo "Outdated reference: $module"
11-
retval=1
38+
echo "*** IN INDEX BUT NO MODULE: $module"
39+
RETVAL=1
1240
fi
1341
fi
1442
done
15-
16-
return $retval
1743
}
1844

19-
verify_index docs/reference/index.rst && \
20-
verify_index docs/internals/reference/index.rst
21-
45+
verify_index docs/reference docs/internals/reference

0 commit comments

Comments
 (0)