Patchwork [1,of,2] tests: use $PYTHON in #! so we always use the right Python

login
register
mail settings
Submitter Augie Fackler
Date June 19, 2017, 2:16 a.m.
Message ID <6b14e1abca3dcb131c77.1497838572@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/21498/
State Accepted
Headers show

Comments

Augie Fackler - June 19, 2017, 2:16 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1497551272 14400
#      Thu Jun 15 14:27:52 2017 -0400
# Node ID 6b14e1abca3dcb131c7765c41f30e903d72e1faa
# Parent  2851b24eecc483ce1546d63d155fa2e9250e3f44
tests: use $PYTHON in #! so we always use the right Python
Yuya Nishihara - June 19, 2017, 2:06 p.m.
On Sun, 18 Jun 2017 22:16:12 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1497551272 14400
> #      Thu Jun 15 14:27:52 2017 -0400
> # Node ID 6b14e1abca3dcb131c7765c41f30e903d72e1faa
> # Parent  2851b24eecc483ce1546d63d155fa2e9250e3f44
> tests: use $PYTHON in #! so we always use the right Python

Queued, thanks.
Yuya Nishihara - June 19, 2017, 2:25 p.m.
On Mon, 19 Jun 2017 23:06:25 +0900, Yuya Nishihara wrote:
> On Sun, 18 Jun 2017 22:16:12 -0400, Augie Fackler wrote:
> > # HG changeset patch
> > # User Augie Fackler <augie@google.com>
> > # Date 1497551272 14400
> > #      Thu Jun 15 14:27:52 2017 -0400
> > # Node ID 6b14e1abca3dcb131c7765c41f30e903d72e1faa
> > # Parent  2851b24eecc483ce1546d63d155fa2e9250e3f44
> > tests: use $PYTHON in #! so we always use the right Python
> 
> Queued, thanks.

> +++ b/tests/test-highlight.t
> @@ -20,7 +20,7 @@
>  create random Python file to exercise Pygments
>  
>    $ cat <<EOF > primes.py
> -  > #!/usr/bin/env python
> +  > #!$PYTHON

Nah, this changes hashes so test-highlight.t fails. Dropped these for now.

Patch

diff --git a/tests/test-bisect.t b/tests/test-bisect.t
--- a/tests/test-bisect.t
+++ b/tests/test-bisect.t
@@ -453,7 +453,7 @@  assuming that the shell returns 127 if c
 test bisecting command
 
   $ cat > script.py <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import sys
   > from mercurial import ui, hg
   > repo = hg.repository(ui.ui.load(), '.')
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -249,7 +249,7 @@  Edit with extdiff -p:
 Prepare custom diff/edit tool:
 
   $ cat > 'diff tool.py' << EOT
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import time
   > time.sleep(1) # avoid unchanged-timestamp problems
   > file('a/a', 'ab').write('edited\n')
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -98,7 +98,7 @@  Command with no output, we just want to 
 Check hgweb's load order:
 
   $ cat > hgweb.cgi <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -20,7 +20,7 @@ 
 create random Python file to exercise Pygments
 
   $ cat <<EOF > primes.py
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > 
   > """Fun with generators. Corresponding Haskell implementation:
   > 
@@ -151,7 +151,7 @@  hgweb filerevision, html
   <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
   <div class="sourcefirst"> line source</div>
   <pre class="sourcelines stripes4 wrap bottomline" data-logurl="/log/tip/primes.py" data-ishead="1">
-  <span id="l1"><span class="c">#!/usr/bin/env python</span></span><a href="#l1"></a>
+  <span id="l1"><span class="c">#!*</span></span><a href="#l1"></a> (glob)
   <span id="l2"></span><a href="#l2"></a>
   <span id="l3"><span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></span><a href="#l3"></a>
   <span id="l4"></span><a href="#l4"></a>
@@ -310,7 +310,7 @@  hgweb fileannotate, html
   <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
-  <td class="source"><a href="#l1">     1</a> <span class="c">#!/usr/bin/env python</span></td>
+  <td class="source"><a href="#l1">     1</a> <span class="c">#!*</span></td> (glob)
   </tr>
   <tr id="l2" class="thisrev">
   <td class="annotate parity0">
@@ -994,7 +994,7 @@  We attempt to highlight unknown files by
   > EOF
 
   $ cat > unknownfile << EOF
-  > #!/usr/bin/python
+  > #!$PYTHON
   > def foo():
   >    pass
   > EOF
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -93,7 +93,7 @@  Verify that largefiles from pulled branc
 Portable way to print file permissions:
 
   $ cat > ls-l.py <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import sys, os
   > path = sys.argv[1]
   > print '%03o' % (os.lstat(path).st_mode & 0777)
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -215,7 +215,7 @@  Test display of largefiles in hgweb
 Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
 
   $ cat <<EOF > "$TESTTMP/hgweb.cgi"
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t
--- a/tests/test-newcgi.t
+++ b/tests/test-newcgi.t
@@ -5,7 +5,7 @@  before d74fc8dec2b4 still work.
 
   $ hg init test
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -31,7 +31,7 @@  before d74fc8dec2b4 still work.
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   > 
diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t
--- a/tests/test-newercgi.t
+++ b/tests/test-newercgi.t
@@ -5,7 +5,7 @@  This is a rudimentary test of the CGI fi
   $ hg init test
 
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -28,7 +28,7 @@  This is a rudimentary test of the CGI fi
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   > 
diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t
--- a/tests/test-oldcgi.t
+++ b/tests/test-oldcgi.t
@@ -4,7 +4,7 @@  This tests if CGI files from before d0db
 
   $ hg init test
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -26,7 +26,7 @@  This tests if CGI files from before d0db
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   > 
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1001,7 +1001,7 @@  running is placed.
   > #endif
   >   $ test "\$RUNTESTDIR" = "$TESTDIR"
   >   $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
-  >   #!/usr/bin/env python
+  >   #!$PYTHON
   >   #
   >   # check-code - a style and portability checker for Mercurial
   > EOF