hgbook

changeset 45:6b7b0339e7d6

Don't rerun examples unnecessarily.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun Jul 23 23:34:24 2006 -0700 (2006-07-23)
parents 012df94a02fe
children dd657c4d3a47
files en/Makefile en/examples/run-example
line diff
     1.1 --- a/en/Makefile	Sun Jul 23 23:25:52 2006 -0700
     1.2 +++ b/en/Makefile	Sun Jul 23 23:34:24 2006 -0700
     1.3 @@ -17,7 +17,6 @@
     1.4  	mq-stack.svg
     1.5  
     1.6  example-sources := \
     1.7 -	examples/run-example \
     1.8  	examples/daily.files \
     1.9  	examples/hook.simple \
    1.10  	examples/hook.ws \
    1.11 @@ -111,8 +110,11 @@
    1.12  
    1.13  examples: examples/.run
    1.14  
    1.15 -examples/.run: $(example-sources)
    1.16 -	cd examples && ./run-example
    1.17 +examples/.run: $(example-sources:%=%.run)
    1.18 +	touch examples/.run
    1.19 +
    1.20 +examples/%.run: examples/% examples/run-example
    1.21 +	cd examples && ./run-example $(notdir $<)
    1.22  
    1.23  build_id.tex: $(wildcard ../.hg/00changelog.[id])
    1.24  	echo -n $(hg_id) > build_id.tex
     2.1 --- a/en/examples/run-example	Sun Jul 23 23:25:52 2006 -0700
     2.2 +++ b/en/examples/run-example	Sun Jul 23 23:34:24 2006 -0700
     2.3 @@ -122,6 +122,7 @@
     2.4                      # then its output
     2.5                      ofp.write(tex_escape(output))
     2.6              self.status('\n')
     2.7 +            open(self.name + '.run', 'w')
     2.8          finally:
     2.9              try:
    2.10                  output = self.sendreceive('exit\n')
    2.11 @@ -143,6 +144,7 @@
    2.12      for name in os.listdir(path):
    2.13          if name == 'run-example' or name.startswith('.'): continue
    2.14          if name.endswith('.out') or name.endswith('~'): continue
    2.15 +        if name.endswith('.run'): continue
    2.16          pathname = os.path.join(path, name)
    2.17          st = os.lstat(pathname)
    2.18          if stat.S_ISREG(st.st_mode) and st.st_mode & 0111: