diff --git a/.gitignore b/.gitignore index ea31ad9..863b2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ /minimal/.do_built /minimal/.do_built.dir *~ -*.pyc *.tmp -/redo-sh *.did -/website +/docs.out diff --git a/Documentation/md-to-man.do b/Documentation/md-to-man.do deleted file mode 100644 index e0fb727..0000000 --- a/Documentation/md-to-man.do +++ /dev/null @@ -1,8 +0,0 @@ -redo-ifchange md2man.py -if ./md2man.py /dev/null /dev/null >/dev/null; then - echo './md2man.py $2.md.tmp $2.html' -else - echo "Warning: md2man.py missing modules; can't generate manpages." >&2 - echo "Warning: try this: sudo easy_install markdown BeautifulSoup" >&2 - echo 'echo Skipping: $2.1 >&2' -fi diff --git a/Makefile b/Makefile index dbda71b..9628c37 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,21 @@ +default: all + +build: + +./do build + all: + +./do all + +test: + +./do test -Makefile: - @ +clean: + +./do clean -%: FORCE - +./redo $@ +install: + +./do install -.PHONY: FORCE +env: + env +.PHONY: build test clean env diff --git a/README.md b/README.md index 49d0f5e..dc8e07c 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ This version, sometimes called apenwarr/redo, is probably the most advanced one, including support for parallel builds, improved logging, and helpful debugging features. +To build and test redo, run `./do -j10 test`. To install it, run +`DESTDIR=/tmp/testinstall PREFIX=/usr/local ./do -j10 install`. + --- - View the [documentation](https://redo.rtfd.io) via readthedocs.org diff --git a/_all.do b/_all.do index 6167bd0..becd87f 100644 --- a/_all.do +++ b/_all.do @@ -3,5 +3,7 @@ if [ "$1,$2" != "_all,_all" ]; then exit 1 fi -redo-ifchange redo-sh -redo-ifchange version/all Documentation/all +# Do this first, to ensure we're using a good shell +redo-ifchange redo/sh + +redo-ifchange bin/all docs/all diff --git a/all.do b/all.do index af2187f..d8350e6 100644 --- a/all.do +++ b/all.do @@ -1,2 +1,2 @@ redo-ifchange _all -echo "Nothing much to do. Try 'redo t/all' or 'redo test'" >&2 +echo "Nothing much to do. Try 'bin/redo -j10 test'" >&2 diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..6192ee6 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,3 @@ +list +redo +redo-* diff --git a/bin/all.do b/bin/all.do new file mode 100644 index 0000000..a60c0e5 --- /dev/null +++ b/bin/all.do @@ -0,0 +1,3 @@ +exec >&2 +redo-ifchange ../redo/version/all ../redo/python list redo-sh +xargs redo-ifchange &2 + +case $1 in + redo-sh) + redo-ifchange ../redo/sh + cat >$3 <<-EOF + #!/bin/sh + d=\$(dirname "\$0")/.. + [ -x \$d/lib/redo/sh ] && exec \$d/lib/redo/sh "\$@" + [ -x \$d/redo/sh ] && exec \$d/redo/sh "\$@" + echo "\$0: fatal: can't find \$d/lib/redo/sh or \$d/redo/sh" >&2 + exit 98 + EOF + chmod a+x "$3" + ;; + redo|redo-*) + redo-ifchange ../redo/whichpython + read py <../redo/whichpython + cmd=${1#redo-} + cat >$3 <<-EOF + #!$py -S + import sys, os; + exe = os.path.realpath(os.path.abspath(sys.argv[0])) + exedir = os.path.dirname(exe) + sys.path.insert(0, os.path.join(exedir, '../lib')) + sys.path.insert(0, os.path.join(exedir, '..')) + import redo.cmd_$cmd + redo.cmd_$cmd.main() + EOF + chmod a+x "$3" + ;; + *) echo "$0: don't know how to build '$1'" >&2; exit 99 ;; +esac diff --git a/bin/list.do b/bin/list.do new file mode 100644 index 0000000..29c887c --- /dev/null +++ b/bin/list.do @@ -0,0 +1,16 @@ +exec >&2 + +redo-always +( + cd ../redo + for d in cmd_*.py; do + d=${d#cmd_} + d=${d%.py} + if [ "$d" = "redo" ]; then + echo redo + else + echo "redo-${d%.py}" + fi + done +) >$3 +redo-stamp <$3 diff --git a/clean.do b/clean.do index 0ae01b6..e8f975e 100644 --- a/clean.do +++ b/clean.do @@ -1,13 +1,13 @@ exec >&2 -rm -rf t/.redo redo-sh +rm -rf t/.redo redo/sh if [ -e .do_built ]; then while read x; do [ -d "$x" ] || rm -f "$x" done <.do_built fi [ -z "$DO_BUILT" ] && rm -rf .do_built .do_built.dir -rm -rf minimal/.do_built minimal/.do_built.dir website -redo t/clean Documentation/clean version/clean +rm -rf minimal/.do_built minimal/.do_built.dir docs.out +redo t/clean docs/clean redo/clean rm -f *~ .*~ */*~ */.*~ *.pyc install.wrapper -find . -name '*.tmp' -exec rm -fv {} \; -find . -name '*.did' -exec rm -fv {} \; +find . -name '*.tmp' -exec rm -f {} \; +find . -name '*.did' -exec rm -f {} \; diff --git a/do b/do new file mode 100755 index 0000000..856218f --- /dev/null +++ b/do @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Bootstrap script, so we can build and test redo using (mostly) redo. +# Before redo is available, we have to use minimal/do to build it. After +# that, we switch to real redo. +# +# NOTE: Don't use this as a model for your own redo projects! It's friendly +# to provide a 'do' script at the top of your project for people who haven't +# installed redo, but that script is usually just a copy of minimal/do, +# because your project probably doesn't have the same bootstrap problem that +# redo itself does. +# + +die() { + echo "$0:" "$@" >&2 + exit 42 +} + +usage() { + echo "Usage: $0 [redo-args...] " >&2 + echo " where valid targets are: build all test install clean" >&2 + echo " and redo-args are optional args for redo, like -j10, -x" >&2 + exit 10 +} + +mydir=$(dirname "$0") +cd "$mydir" || die "can't find self in dir: $mydir" + +args= +while [ "$1" != "${1#-}" ]; do + args="$args $1" + shift +done + +if [ "$#" -gt 1 ]; then + usage +fi + +if [ -n "$args" -a "$#" -lt 1 ]; then + usage +fi + +if [ "$#" -lt 1 ]; then + # if no extra args given, use a default target + target=all +else + target=$1 +fi + + +build() { + ./minimal/do -c bin/all || die "failed to compile redo." + bin/redo bin/all || die "redo failed self test." +} + +clean() { + ./minimal/do -c clean || die "failed to clean." + rm -rf .redo .do_built .do_built.dir +} + +case $target in + build) + build + ;; + all|install) + build && bin/redo $args "$target" + ;; + test) + # Test both redo and minimal/do + build + PATH=$PWD/redo:$PATH minimal/do test || die "minimal/do test failed" + clean + build + bin/redo $args test || die "redo test failed" + ;; + clean) + clean + ;; + *) + echo "$0: unknown target '$target'" >&2 + exit 11 + ;; +esac diff --git a/Documentation/.gitignore b/docs/.gitignore similarity index 100% rename from Documentation/.gitignore rename to docs/.gitignore diff --git a/Documentation/Contributing.md b/docs/Contributing.md similarity index 100% rename from Documentation/Contributing.md rename to docs/Contributing.md diff --git a/Documentation/FAQBasics.md b/docs/FAQBasics.md similarity index 100% rename from Documentation/FAQBasics.md rename to docs/FAQBasics.md diff --git a/Documentation/FAQImpl.md b/docs/FAQImpl.md similarity index 100% rename from Documentation/FAQImpl.md rename to docs/FAQImpl.md diff --git a/Documentation/FAQInterop.md b/docs/FAQInterop.md similarity index 100% rename from Documentation/FAQInterop.md rename to docs/FAQInterop.md diff --git a/Documentation/FAQParallel.md b/docs/FAQParallel.md similarity index 100% rename from Documentation/FAQParallel.md rename to docs/FAQParallel.md diff --git a/Documentation/FAQSemantics.md b/docs/FAQSemantics.md similarity index 100% rename from Documentation/FAQSemantics.md rename to docs/FAQSemantics.md diff --git a/Documentation/GettingStarted.md b/docs/GettingStarted.md similarity index 100% rename from Documentation/GettingStarted.md rename to docs/GettingStarted.md diff --git a/Documentation/Roadmap.md b/docs/Roadmap.md similarity index 100% rename from Documentation/Roadmap.md rename to docs/Roadmap.md diff --git a/Documentation/all.do b/docs/all.do similarity index 100% rename from Documentation/all.do rename to docs/all.do diff --git a/Documentation/clean.do b/docs/clean.do similarity index 100% rename from Documentation/clean.do rename to docs/clean.do diff --git a/Documentation/cookbook/all.do b/docs/cookbook/all.do similarity index 100% rename from Documentation/cookbook/all.do rename to docs/cookbook/all.do diff --git a/Documentation/cookbook/clean.do b/docs/cookbook/clean.do similarity index 100% rename from Documentation/cookbook/clean.do rename to docs/cookbook/clean.do diff --git a/Documentation/cookbook/defaults/.gitignore b/docs/cookbook/defaults/.gitignore similarity index 100% rename from Documentation/cookbook/defaults/.gitignore rename to docs/cookbook/defaults/.gitignore diff --git a/Documentation/cookbook/defaults/all.do b/docs/cookbook/defaults/all.do similarity index 100% rename from Documentation/cookbook/defaults/all.do rename to docs/cookbook/defaults/all.do diff --git a/Documentation/cookbook/defaults/clean.do b/docs/cookbook/defaults/clean.do similarity index 100% rename from Documentation/cookbook/defaults/clean.do rename to docs/cookbook/defaults/clean.do diff --git a/Documentation/cookbook/defaults/date.do b/docs/cookbook/defaults/date.do similarity index 100% rename from Documentation/cookbook/defaults/date.do rename to docs/cookbook/defaults/date.do diff --git a/Documentation/cookbook/defaults/default.do b/docs/cookbook/defaults/default.do similarity index 100% rename from Documentation/cookbook/defaults/default.do rename to docs/cookbook/defaults/default.do diff --git a/Documentation/cookbook/defaults/include/version.h.in b/docs/cookbook/defaults/include/version.h.in similarity index 100% rename from Documentation/cookbook/defaults/include/version.h.in rename to docs/cookbook/defaults/include/version.h.in diff --git a/Documentation/cookbook/defaults/index.md b/docs/cookbook/defaults/index.md similarity index 99% rename from Documentation/cookbook/defaults/index.md rename to docs/cookbook/defaults/index.md index 587ba2f..a0eeec2 100644 --- a/Documentation/cookbook/defaults/index.md +++ b/docs/cookbook/defaults/index.md @@ -8,7 +8,7 @@ today's date. To play with this code on your own machine, get the [redo source code](https://github.com/apenwarr/redo) and look in the -`Documentation/cookbook/defaults/` directory. +`docs/cookbook/defaults/` directory. ### Input files diff --git a/Documentation/cookbook/defaults/test.py b/docs/cookbook/defaults/test.py similarity index 100% rename from Documentation/cookbook/defaults/test.py rename to docs/cookbook/defaults/test.py diff --git a/Documentation/cookbook/defaults/test.txt.in b/docs/cookbook/defaults/test.txt.in similarity index 100% rename from Documentation/cookbook/defaults/test.txt.in rename to docs/cookbook/defaults/test.txt.in diff --git a/Documentation/cookbook/defaults/version.do b/docs/cookbook/defaults/version.do similarity index 100% rename from Documentation/cookbook/defaults/version.do rename to docs/cookbook/defaults/version.do diff --git a/Documentation/cookbook/defaults/version.py.in b/docs/cookbook/defaults/version.py.in similarity index 100% rename from Documentation/cookbook/defaults/version.py.in rename to docs/cookbook/defaults/version.py.in diff --git a/Documentation/cookbook/hello/.gitignore b/docs/cookbook/hello/.gitignore similarity index 100% rename from Documentation/cookbook/hello/.gitignore rename to docs/cookbook/hello/.gitignore diff --git a/Documentation/cookbook/hello/all.do b/docs/cookbook/hello/all.do similarity index 100% rename from Documentation/cookbook/hello/all.do rename to docs/cookbook/hello/all.do diff --git a/Documentation/cookbook/hello/clean.do b/docs/cookbook/hello/clean.do similarity index 100% rename from Documentation/cookbook/hello/clean.do rename to docs/cookbook/hello/clean.do diff --git a/Documentation/cookbook/hello/hello.c b/docs/cookbook/hello/hello.c similarity index 100% rename from Documentation/cookbook/hello/hello.c rename to docs/cookbook/hello/hello.c diff --git a/Documentation/cookbook/hello/hello.do b/docs/cookbook/hello/hello.do similarity index 100% rename from Documentation/cookbook/hello/hello.do rename to docs/cookbook/hello/hello.do diff --git a/Documentation/cookbook/hello/index.md b/docs/cookbook/hello/index.md similarity index 98% rename from Documentation/cookbook/hello/index.md rename to docs/cookbook/hello/index.md index 225e8e5..d27552b 100644 --- a/Documentation/cookbook/hello/index.md +++ b/docs/cookbook/hello/index.md @@ -7,7 +7,7 @@ compile it. To play with the code on your own machine, get the [redo source code](https://github.com/apenwarr/redo) and look in the -`Documentation/cookbook/hello/` directory. +`docs/cookbook/hello/` directory. ### Compiling the code diff --git a/Documentation/cookbook/hello/test.do b/docs/cookbook/hello/test.do similarity index 100% rename from Documentation/cookbook/hello/test.do rename to docs/cookbook/hello/test.do diff --git a/Documentation/cookbook/latex/.gitignore b/docs/cookbook/latex/.gitignore similarity index 100% rename from Documentation/cookbook/latex/.gitignore rename to docs/cookbook/latex/.gitignore diff --git a/Documentation/cookbook/latex/all.do b/docs/cookbook/latex/all.do similarity index 100% rename from Documentation/cookbook/latex/all.do rename to docs/cookbook/latex/all.do diff --git a/Documentation/cookbook/latex/clean.do b/docs/cookbook/latex/clean.do similarity index 100% rename from Documentation/cookbook/latex/clean.do rename to docs/cookbook/latex/clean.do diff --git a/Documentation/cookbook/latex/default.dvi.do b/docs/cookbook/latex/default.dvi.do similarity index 100% rename from Documentation/cookbook/latex/default.dvi.do rename to docs/cookbook/latex/default.dvi.do diff --git a/Documentation/cookbook/latex/default.pdf.do b/docs/cookbook/latex/default.pdf.do similarity index 100% rename from Documentation/cookbook/latex/default.pdf.do rename to docs/cookbook/latex/default.pdf.do diff --git a/Documentation/cookbook/latex/default.ps.do b/docs/cookbook/latex/default.ps.do similarity index 100% rename from Documentation/cookbook/latex/default.ps.do rename to docs/cookbook/latex/default.ps.do diff --git a/Documentation/cookbook/latex/default.runtex.do b/docs/cookbook/latex/default.runtex.do similarity index 100% rename from Documentation/cookbook/latex/default.runtex.do rename to docs/cookbook/latex/default.runtex.do diff --git a/Documentation/cookbook/latex/discovery.txt b/docs/cookbook/latex/discovery.txt similarity index 100% rename from Documentation/cookbook/latex/discovery.txt rename to docs/cookbook/latex/discovery.txt diff --git a/Documentation/cookbook/latex/index.md b/docs/cookbook/latex/index.md similarity index 99% rename from Documentation/cookbook/latex/index.md rename to docs/cookbook/latex/index.md index 042d495..515943f 100644 --- a/Documentation/cookbook/latex/index.md +++ b/docs/cookbook/latex/index.md @@ -10,7 +10,7 @@ ggplot2](https://ggplot2.tidyverse.org/). To play with this code on your own machine, get the [redo source code](https://github.com/apenwarr/redo) and look in the -`Documentation/cookbook/latex/` directory. +`docs/cookbook/latex/` directory. ### Generating a plot from an R script diff --git a/Documentation/cookbook/latex/mpg.R b/docs/cookbook/latex/mpg.R similarity index 100% rename from Documentation/cookbook/latex/mpg.R rename to docs/cookbook/latex/mpg.R diff --git a/Documentation/cookbook/latex/mpg.eps.do b/docs/cookbook/latex/mpg.eps.do similarity index 100% rename from Documentation/cookbook/latex/mpg.eps.do rename to docs/cookbook/latex/mpg.eps.do diff --git a/Documentation/cookbook/latex/paper.deps b/docs/cookbook/latex/paper.deps similarity index 100% rename from Documentation/cookbook/latex/paper.deps rename to docs/cookbook/latex/paper.deps diff --git a/Documentation/cookbook/latex/paper.latex b/docs/cookbook/latex/paper.latex similarity index 100% rename from Documentation/cookbook/latex/paper.latex rename to docs/cookbook/latex/paper.latex diff --git a/Documentation/default.1.do b/docs/default.1.do similarity index 100% rename from Documentation/default.1.do rename to docs/default.1.do diff --git a/Documentation/default.md.tmp.do b/docs/default.md.tmp.do similarity index 58% rename from Documentation/default.md.tmp.do rename to docs/default.md.tmp.do index 07f196a..0ddf3bc 100644 --- a/Documentation/default.md.tmp.do +++ b/docs/default.md.tmp.do @@ -1,5 +1,5 @@ -redo-ifchange ../version/vars $2.md -. ../version/vars +redo-ifchange ../redo/version/vars $2.md +. ../redo/version/vars cat - $2.md <<-EOF % $2(1) Redo $TAG % Avery Pennarun diff --git a/Documentation/doc.list.do b/docs/doc.list.do similarity index 100% rename from Documentation/doc.list.do rename to docs/doc.list.do diff --git a/Documentation/extra_style.css b/docs/extra_style.css similarity index 100% rename from Documentation/extra_style.css rename to docs/extra_style.css diff --git a/Documentation/fetchcode.js b/docs/fetchcode.js similarity index 100% rename from Documentation/fetchcode.js rename to docs/fetchcode.js diff --git a/Documentation/git-export.do b/docs/git-export.do similarity index 91% rename from Documentation/git-export.do rename to docs/git-export.do index dc6d04f..0acaf83 100644 --- a/Documentation/git-export.do +++ b/docs/git-export.do @@ -8,7 +8,7 @@ rm -f $GIT_INDEX_FILE git add -f *.1 MSG="Autogenerated man pages for $(git describe)" -TREE=$(git write-tree --prefix=Documentation) +TREE=$(git write-tree --prefix=docs) git show-ref refs/heads/man >/dev/null && PARENT="-p refs/heads/man" COMMITID=$(echo "$MSG" | git commit-tree $TREE $PARENT) diff --git a/Documentation/git-import.do b/docs/git-import.do similarity index 100% rename from Documentation/git-import.do rename to docs/git-import.do diff --git a/Documentation/index.md b/docs/index.md similarity index 98% rename from Documentation/index.md rename to docs/index.md index 0efc45d..21f0941 100644 --- a/Documentation/index.md +++ b/docs/index.md @@ -170,7 +170,7 @@ easily be linked from this document. Here are a few open source examples: in order to clean up its dependency logic. * You can also find some curated examples in the - [Documentation/cookbook/](https://github.com/apenwarr/redo/tree/master/Documentation/cookbook/) subdir of the redo project itself. + [docs/cookbook/](https://github.com/apenwarr/redo/tree/master/docs/cookbook/) subdir of the redo project itself. * A [github search for all.do](https://github.com/search?p=9&q=path%3A%2F+extension%3Ado+filename%3A%2Fall.do&type=Code) shows an ever-growing number of projects using redo. diff --git a/docs/md-to-man.do b/docs/md-to-man.do new file mode 100644 index 0000000..5d4d3fa --- /dev/null +++ b/docs/md-to-man.do @@ -0,0 +1,9 @@ +redo-ifchange md2man.py ../redo/whichpython +read py <../redo/whichpython +if ../redo/python ./md2man.py /dev/null /dev/null >/dev/null; then + echo '../redo/python ./md2man.py $2.md.tmp $2.html' +else + echo "Warning: md2man.py missing modules; can't generate manpages." >&2 + echo "Warning: try this: sudo easy_install markdown BeautifulSoup" >&2 + echo 'echo Skipping: $2.1 >&2' +fi diff --git a/Documentation/md2man.py b/docs/md2man.py old mode 100755 new mode 100644 similarity index 99% rename from Documentation/md2man.py rename to docs/md2man.py index d58a309..035d2ac --- a/Documentation/md2man.py +++ b/docs/md2man.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os, markdown, re from BeautifulSoup import BeautifulSoup diff --git a/Documentation/mkdocs.do b/docs/mkdocs.do similarity index 100% rename from Documentation/mkdocs.do rename to docs/mkdocs.do diff --git a/Documentation/redo-always.md b/docs/redo-always.md similarity index 100% rename from Documentation/redo-always.md rename to docs/redo-always.md diff --git a/Documentation/redo-ifchange.md b/docs/redo-ifchange.md similarity index 100% rename from Documentation/redo-ifchange.md rename to docs/redo-ifchange.md diff --git a/Documentation/redo-ifcreate.md b/docs/redo-ifcreate.md similarity index 100% rename from Documentation/redo-ifcreate.md rename to docs/redo-ifcreate.md diff --git a/Documentation/redo-log.md b/docs/redo-log.md similarity index 100% rename from Documentation/redo-log.md rename to docs/redo-log.md diff --git a/Documentation/redo-ood.md b/docs/redo-ood.md similarity index 100% rename from Documentation/redo-ood.md rename to docs/redo-ood.md diff --git a/Documentation/redo-sources.md b/docs/redo-sources.md similarity index 100% rename from Documentation/redo-sources.md rename to docs/redo-sources.md diff --git a/Documentation/redo-stamp.md b/docs/redo-stamp.md similarity index 100% rename from Documentation/redo-stamp.md rename to docs/redo-stamp.md diff --git a/Documentation/redo-targets.md b/docs/redo-targets.md similarity index 100% rename from Documentation/redo-targets.md rename to docs/redo-targets.md diff --git a/Documentation/redo-whichdo.md b/docs/redo-whichdo.md similarity index 100% rename from Documentation/redo-whichdo.md rename to docs/redo-whichdo.md diff --git a/Documentation/redo.md b/docs/redo.md similarity index 100% rename from Documentation/redo.md rename to docs/redo.md diff --git a/Documentation/t/testitem.md b/docs/t/testitem.md similarity index 100% rename from Documentation/t/testitem.md rename to docs/t/testitem.md diff --git a/Documentation/test.do b/docs/test.do similarity index 100% rename from Documentation/test.do rename to docs/test.do diff --git a/install.do b/install.do index edbb87f..51dbc0e 100644 --- a/install.do +++ b/install.do @@ -1,49 +1,42 @@ exec >&2 -redo-ifchange _all : ${INSTALL:=install} -: ${DESTDIR:=} +: ${DESTDIR=NONE} : ${PREFIX:=/usr} : ${MANDIR:=$DESTDIR$PREFIX/share/man} : ${DOCDIR:=$DESTDIR$PREFIX/share/doc/redo} : ${BINDIR:=$DESTDIR$PREFIX/bin} : ${LIBDIR:=$DESTDIR$PREFIX/lib/redo} +if [ "$DESTDIR" = "NONE" ]; then + echo "$0: fatal: set DESTDIR before trying to install." + exit 99 +fi + +redo-ifchange _all redo/whichpython +read py install.wrapper <<-EOF - #!/usr/bin/python2 - import sys, os; - exedir = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) - sys.path.insert(0, os.path.join(exedir, '../lib/redo')) - import $fix - $fix.main() - EOF - $INSTALL -m 0755 install.wrapper $BINDIR/$d -done -rm -f install.wrapper +bins=$(ls bin/redo* | grep '^bin/redo[-a-z]*$') +$INSTALL -m 0755 $bins $BINDIR/ diff --git a/mkdocs.yml b/mkdocs.yml index f155c3e..39c7fe8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,10 +1,10 @@ site_name: "redo: a recursive build system" theme: readthedocs -docs_dir: Documentation -site_dir: website +docs_dir: docs +site_dir: docs.out strict: true repo_url: https://github.com/apenwarr/redo -edit_uri: edit/master/Documentation +edit_uri: edit/master/docs extra_javascript: - fetchcode.js extra_css: diff --git a/redo b/redo deleted file mode 120000 index d9204f9..0000000 --- a/redo +++ /dev/null @@ -1 +0,0 @@ -redo.py \ No newline at end of file diff --git a/redo-always b/redo-always deleted file mode 120000 index 1ba5266..0000000 --- a/redo-always +++ /dev/null @@ -1 +0,0 @@ -redo-always.py \ No newline at end of file diff --git a/redo-ifchange b/redo-ifchange deleted file mode 120000 index 28bfe24..0000000 --- a/redo-ifchange +++ /dev/null @@ -1 +0,0 @@ -redo-ifchange.py \ No newline at end of file diff --git a/redo-ifcreate b/redo-ifcreate deleted file mode 120000 index 1ab7c33..0000000 --- a/redo-ifcreate +++ /dev/null @@ -1 +0,0 @@ -redo-ifcreate.py \ No newline at end of file diff --git a/redo-log b/redo-log deleted file mode 120000 index dd3b7c1..0000000 --- a/redo-log +++ /dev/null @@ -1 +0,0 @@ -redo-log.py \ No newline at end of file diff --git a/redo-ood b/redo-ood deleted file mode 120000 index b1a633d..0000000 --- a/redo-ood +++ /dev/null @@ -1 +0,0 @@ -redo-ood.py \ No newline at end of file diff --git a/redo-sources b/redo-sources deleted file mode 120000 index 18c452d..0000000 --- a/redo-sources +++ /dev/null @@ -1 +0,0 @@ -redo-sources.py \ No newline at end of file diff --git a/redo-stamp b/redo-stamp deleted file mode 120000 index 3dedf9a..0000000 --- a/redo-stamp +++ /dev/null @@ -1 +0,0 @@ -redo-stamp.py \ No newline at end of file diff --git a/redo-targets b/redo-targets deleted file mode 120000 index 0816d62..0000000 --- a/redo-targets +++ /dev/null @@ -1 +0,0 @@ -redo-targets.py \ No newline at end of file diff --git a/redo-unlocked b/redo-unlocked deleted file mode 120000 index c7dcd83..0000000 --- a/redo-unlocked +++ /dev/null @@ -1 +0,0 @@ -redo-unlocked.py \ No newline at end of file diff --git a/redo-whichdo b/redo-whichdo deleted file mode 120000 index 0962250..0000000 --- a/redo-whichdo +++ /dev/null @@ -1 +0,0 @@ -redo-whichdo.py \ No newline at end of file diff --git a/redo/.gitignore b/redo/.gitignore new file mode 100644 index 0000000..e1d3f62 --- /dev/null +++ b/redo/.gitignore @@ -0,0 +1,4 @@ +*.pyc +sh +whichpython +python diff --git a/redo/__init__.py b/redo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/atoi.py b/redo/atoi.py similarity index 100% rename from atoi.py rename to redo/atoi.py diff --git a/builder.py b/redo/builder.py similarity index 100% rename from builder.py rename to redo/builder.py diff --git a/redo/clean.do b/redo/clean.do new file mode 100644 index 0000000..86658b9 --- /dev/null +++ b/redo/clean.do @@ -0,0 +1,2 @@ +redo version/clean +rm -f whichpython python *.pyc */*.pyc diff --git a/redo-always.py b/redo/cmd_always.py old mode 100755 new mode 100644 similarity index 95% rename from redo-always.py rename to redo/cmd_always.py index ea0ade5..de86717 --- a/redo-always.py +++ b/redo/cmd_always.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars, state diff --git a/redo-ifchange.py b/redo/cmd_ifchange.py old mode 100755 new mode 100644 similarity index 98% rename from redo-ifchange.py rename to redo/cmd_ifchange.py index 57875c4..d27d03f --- a/redo-ifchange.py +++ b/redo/cmd_ifchange.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import os, sys, traceback import vars_init diff --git a/redo-ifcreate.py b/redo/cmd_ifcreate.py old mode 100755 new mode 100644 similarity index 96% rename from redo-ifcreate.py rename to redo/cmd_ifcreate.py index 52013ac..bd65b25 --- a/redo-ifcreate.py +++ b/redo/cmd_ifcreate.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars, state from logs import err diff --git a/redo-log.py b/redo/cmd_log.py old mode 100755 new mode 100644 similarity index 99% rename from redo-log.py rename to redo/cmd_log.py index 827ae73..1eed94f --- a/redo-log.py +++ b/redo/cmd_log.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import errno, fcntl, os, re, struct, sys, time import termios from atoi import atoi diff --git a/redo-ood.py b/redo/cmd_ood.py old mode 100755 new mode 100644 similarity index 97% rename from redo-ood.py rename to redo/cmd_ood.py index a999fcf..41c50a0 --- a/redo-ood.py +++ b/redo/cmd_ood.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars_init diff --git a/redo.py b/redo/cmd_redo.py old mode 100755 new mode 100644 similarity index 99% rename from redo.py rename to redo/cmd_redo.py index 61eb9e9..8e2ea5d --- a/redo.py +++ b/redo/cmd_redo.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 # # Copyright 2010-2018 Avery Pennarun and contributors # diff --git a/redo-sources.py b/redo/cmd_sources.py old mode 100755 new mode 100644 similarity index 94% rename from redo-sources.py rename to redo/cmd_sources.py index b550877..0c1a716 --- a/redo-sources.py +++ b/redo/cmd_sources.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars_init diff --git a/redo-stamp.py b/redo/cmd_stamp.py old mode 100755 new mode 100644 similarity index 98% rename from redo-stamp.py rename to redo/cmd_stamp.py index 02b6a0b..20fbb05 --- a/redo-stamp.py +++ b/redo/cmd_stamp.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars, state from logs import err, debug2 diff --git a/redo-targets.py b/redo/cmd_targets.py old mode 100755 new mode 100644 similarity index 94% rename from redo-targets.py rename to redo/cmd_targets.py index fd20737..47e75fe --- a/redo-targets.py +++ b/redo/cmd_targets.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars_init diff --git a/redo-unlocked.py b/redo/cmd_unlocked.py old mode 100755 new mode 100644 similarity index 97% rename from redo-unlocked.py rename to redo/cmd_unlocked.py index 0418c60..8ff87cf --- a/redo-unlocked.py +++ b/redo/cmd_unlocked.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import state from logs import err diff --git a/redo-whichdo.py b/redo/cmd_whichdo.py old mode 100755 new mode 100644 similarity index 97% rename from redo-whichdo.py rename to redo/cmd_whichdo.py index 7cace82..7107d12 --- a/redo-whichdo.py +++ b/redo/cmd_whichdo.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os import vars_init diff --git a/deps.py b/redo/deps.py similarity index 100% rename from deps.py rename to redo/deps.py diff --git a/helpers.py b/redo/helpers.py similarity index 100% rename from helpers.py rename to redo/helpers.py diff --git a/jwack.py b/redo/jwack.py similarity index 100% rename from jwack.py rename to redo/jwack.py diff --git a/logs.py b/redo/logs.py similarity index 100% rename from logs.py rename to redo/logs.py diff --git a/options.py b/redo/options.py similarity index 100% rename from options.py rename to redo/options.py diff --git a/paths.py b/redo/paths.py similarity index 100% rename from paths.py rename to redo/paths.py diff --git a/redo/python.do b/redo/python.do new file mode 100644 index 0000000..11d4bf4 --- /dev/null +++ b/redo/python.do @@ -0,0 +1,7 @@ +redo-ifchange whichpython +read py $3 <<-EOF + #!/bin/sh + exec $py "\$@" +EOF +chmod a+x $3 diff --git a/redo-sh.do b/redo/sh.do similarity index 86% rename from redo-sh.do rename to redo/sh.do index 52f0120..af01ac0 100644 --- a/redo-sh.do +++ b/redo/sh.do @@ -1,7 +1,7 @@ exec >&2 -redo-ifchange t/shelltest.od +redo-ifchange ../t/shelltest.od -rm -rf $1.new $1/sh +rm -rf $1.new mkdir $1.new GOOD= @@ -22,9 +22,10 @@ for sh in dash /usr/xpg4/bin/sh ash posh mksh ksh ksh88 ksh93 pdksh \ # they'll fail the test. rm -f $1.new/sh ln -s $FOUND $1.new/sh + SH=$PWD/$1.new/sh set +e - ( cd t && ../$1.new/sh shelltest.od >shelltest.tmp 2>&1 ) + ( cd ../t && $SH shelltest.od ) >shelltest.tmp 2>&1 RV=$? set -e @@ -37,8 +38,8 @@ for sh in dash /usr/xpg4/bin/sh ash posh mksh ksh ksh88 ksh93 pdksh \ crash=$line [ "$line" = "$stripw" ] || msgs="$msgs W$stripw" [ "$line" = "$stripf" ] || msgs="$msgs F$stripf" - done &2 +for py in python2.7 python2 python; do + echo "Trying: $py" + cmd=$(command -v "$py") + # intentionally using the 'print statement' (as opposed to print + # function) here, to rule out any python3 interpreters + out=$($cmd -c 'print "success"' 2>/dev/null) || true + if [ "$out" = "success" ]; then + echo $cmd >$3 + exit 0 + fi +done +exit 10 diff --git a/t/.gitignore b/t/.gitignore index 1ac69ff..d81f3a1 100644 --- a/t/.gitignore +++ b/t/.gitignore @@ -1,3 +1,4 @@ /broken /shellfile /stress.log +/flush-cache diff --git a/t/101-atime/atime2.do b/t/101-atime/atime2.do index d4f4fcf..ede849b 100644 --- a/t/101-atime/atime2.do +++ b/t/101-atime/atime2.do @@ -1,6 +1,6 @@ # make sure redo doesn't think merely *reading* the old file counts as # modifying it in-place. cat $1 >/dev/null 2>/dev/null || true -./tick +../../redo/python tick.py cat $1 >/dev/null 2>/dev/null || true echo hello diff --git a/t/101-atime/tick b/t/101-atime/tick.py old mode 100755 new mode 100644 similarity index 84% rename from t/101-atime/tick rename to t/101-atime/tick.py index 269165e..04a0b04 --- a/t/101-atime/tick +++ b/t/101-atime/tick.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import time t2 = int(time.time()) + 1.0 while 1: diff --git a/t/130-mode/all.do b/t/130-mode/all.do index a53eca8..4d5b88b 100644 --- a/t/130-mode/all.do +++ b/t/130-mode/all.do @@ -1,5 +1,5 @@ umask 0022 redo mode1 -MODE=$(python2 -c 'import os; print oct(os.stat("mode1").st_mode & 07777)') +MODE=$(../../redo/python -c \ + 'import os; print oct(os.stat("mode1").st_mode & 07777)') [ "$MODE" = "0644" ] || exit 78 - diff --git a/t/all.do b/t/all.do index 4e9f6bb..e1187af 100644 --- a/t/all.do +++ b/t/all.do @@ -1,3 +1,5 @@ +redo-ifchange flush-cache + # tests that "set -e" works (.do scripts always run with -e set by default) rm -f 000-set-minus-e/log redo 000-set-minus-e/all diff --git a/t/clean.do b/t/clean.do index 13f562a..035f89e 100644 --- a/t/clean.do +++ b/t/clean.do @@ -2,5 +2,5 @@ sed 's/\.do$//' | xargs redo -rm -f broken shellfile *~ .*~ stress.log +rm -f broken shellfile *~ .*~ stress.log flush-cache rm -rf 'space home dir' diff --git a/t/flush-cache.do b/t/flush-cache.do new file mode 100644 index 0000000..d9ac751 --- /dev/null +++ b/t/flush-cache.do @@ -0,0 +1,7 @@ +redo-ifchange ../redo/whichpython $1.in +read py <../redo/whichpython +( + echo "#!$py" + cat $1.in +) >$3 +chmod a+x $3 diff --git a/t/flush-cache b/t/flush-cache.in similarity index 98% rename from t/flush-cache rename to t/flush-cache.in index 90b226a..c38e761 100755 --- a/t/flush-cache +++ b/t/flush-cache.in @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import sys, os, sqlite3 if "DO_BUILT" in os.environ: diff --git a/test.do b/test.do index 9650ea6..b816c54 100644 --- a/test.do +++ b/test.do @@ -1,3 +1,3 @@ redo-ifchange _all -redo minimal/test Documentation/test t/all +redo minimal/test docs/test t/all [ -n "$DO_BUILT" ] || echo "Don't forget to test 'minimal/do -c test'" >&2