Directory reorg: move code into redo/, generate binaries in bin/.
It's time to start preparing for a version of redo that doesn't work unless we build it first (because it will rely on C modules, and eventually be rewritten in C altogether). To get rolling, remove the old-style symlinks to the main programs, and rename those programs from redo-*.py to redo/cmd_*.py. We'll also move all library functions into the redo/ dir, which is a more python-style naming convention. Previously, install.do was generating wrappers for installing in /usr/bin, which extend sys.path and then import+run the right file. This made "installed" redo work quite differently from running redo inside its source tree. Instead, let's always generate the wrappers in bin/, and not make anything executable except those wrappers. Since we're generating wrappers anyway, let's actually auto-detect the right version of python for the running system; distros can't seem to agree on what to call their python2 binaries (sigh). We'll fill in the right #! shebang lines. Since we're doing that, we can stop using /usr/bin/env, which will a) make things slightly faster, and b) let us use "python -S", which tells python not to load a bunch of extra crap we're not using, thus improving startup times. Annoyingly, we now have to build redo using minimal/do, then run the tests using bin/redo. To make this less annoying, we add a toplevel ./do script that knows the right steps, and a Makefile (whee!) for people who are used to typing 'make' and 'make test' and 'make clean'.
This commit is contained in:
parent
5bc7c861b6
commit
f6fe00db5c
140 changed files with 256 additions and 99 deletions
58
docs/cookbook/latex/default.runtex.do
Normal file
58
docs/cookbook/latex/default.runtex.do
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# latex produces log output on stdout, which is
|
||||
# not really correct. Send it to stderr instead.
|
||||
exec >&2
|
||||
|
||||
# We depend on both the .latex file and its .deps
|
||||
# file (which lists additional dependencies)
|
||||
redo-ifchange "$2.latex" "$2.deps"
|
||||
|
||||
# Next, we have to depend on each dependency in
|
||||
# the .deps file.
|
||||
cat "$2.deps" | xargs redo-ifchange
|
||||
|
||||
tmp="$2.tmp"
|
||||
rm -rf "$tmp"
|
||||
mkdir -p "$tmp"
|
||||
|
||||
# latex generates eg. the table of contents by
|
||||
# using a list of references ($2.aux) generated
|
||||
# during its run. The first time, the table of
|
||||
# contents is empty, so we have to run again.
|
||||
# But then the table of contents is non-empty,
|
||||
# which might cause page numbers to change, and
|
||||
# so on. So we have to keep re-running until it
|
||||
# finally stops changing.
|
||||
touch "$tmp/$2.aux.old"
|
||||
ok=
|
||||
for i in $(seq 5); do
|
||||
latex --halt-on-error \
|
||||
--output-directory="$tmp" \
|
||||
--recorder \
|
||||
"$2.latex" </dev/null
|
||||
if diff "$tmp/$2.aux.old" \
|
||||
"$tmp/$2.aux" >/dev/null; then
|
||||
# .aux file converged, so we're done
|
||||
ok=1
|
||||
break
|
||||
fi
|
||||
echo
|
||||
echo "$0: $2.aux changed: try again (try #$i)"
|
||||
echo
|
||||
cp "$tmp/$2.aux" "$tmp/$2.aux.old"
|
||||
done
|
||||
|
||||
if [ "$ok" = "" ]; then
|
||||
echo "$0: fatal: $2.aux did not converge!"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
# If the newly produced .dvi disappears, we need
|
||||
# to redo.
|
||||
redo-ifchange "$tmp/$2.dvi"
|
||||
|
||||
# With --recorder, latex produces a list of files
|
||||
# it used during its run. Let's depend on all of
|
||||
# them, so if they ever change, we'll redo.
|
||||
grep ^INPUT "$tmp/$2.fls" |
|
||||
cut -d' ' -f2 |
|
||||
xargs redo-ifchange
|
||||
Loading…
Add table
Add a link
Reference in a new issue