# HG changeset patch # User Bryan O'Sullivan # Date 1175033087 25200 # Node ID 5f305adeb5845dc332cc4a3cdfd030ddbb7eda16 # Parent 8c1703a982669f8ce2ca7c4c086437ad0762384c Try to tighten up the run environment to make things more reproducible. diff -r 8c1703a98266 -r 5f305adeb584 en/Makefile --- a/en/Makefile Mon Mar 26 23:57:58 2007 -0700 +++ b/en/Makefile Tue Mar 27 15:04:47 2007 -0700 @@ -78,6 +78,9 @@ tour \ tour-merge-conflict +example-prereqs := \ + /usr/bin/merge + dist-sources := \ ../html/hgicon.png \ ../html/index.html.var \ @@ -161,7 +164,7 @@ %.eps: %.dot dot -Tps -o $@ $< -examples: examples/.run +examples: $(example-prereqs) examples/.run examples/.run: $(example-sources:%=examples/%.run) touch examples/.run diff -r 8c1703a98266 -r 5f305adeb584 en/examples/run-example --- a/en/examples/run-example Mon Mar 26 23:57:58 2007 -0700 +++ b/en/examples/run-example Tue Mar 27 15:04:47 2007 -0700 @@ -46,6 +46,13 @@ raise return False +def find_path_to(program): + for p in os.environ.get('PATH', os.defpath).split(os.pathsep): + name = os.path.join(p, program) + if os.access(name, os.X_OK): + return p + return None + class example: shell = '/usr/bin/env bash' ps1 = '__run_example_ps1__ ' @@ -147,6 +154,16 @@ print >> rcfp, 'PS1="%s"' % self.ps1 print >> rcfp, 'PS2="%s"' % self.ps2 print >> rcfp, 'unset HISTFILE' + path = ['/usr/bin', '/bin'] + hg = find_path_to('hg') + if hg and hg not in path: + path.append(hg) + def re_export(envar): + v = os.getenv(envar) + if v is not None: + print >> rcfp, 'export ' + envar + '=' + v + print >> rcfp, 'export PATH=' + ':'.join(path) + re_export('PYTHONPATH') print >> rcfp, 'export EXAMPLE_DIR="%s"' % os.getcwd() print >> rcfp, 'export HGMERGE=merge' print >> rcfp, 'export LANG=C' @@ -160,8 +177,8 @@ sys.stderr.flush() self.pid, self.cfd = pty.fork() if self.pid == 0: - cmdline = ['/usr/bin/env', 'bash', '--noediting', '--noprofile', - '--norc'] + cmdline = ['/usr/bin/env', '-i', 'bash', '--noediting', + '--noprofile', '--norc'] try: os.execv(cmdline[0], cmdline) except OSError, err: