[PATCH 5 of 5] py3: quote several instances of $PYTHON for Windows

Matt Harbison mharbison72 at gmail.com
Sun Dec 9 22:44:37 EST 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1544408614 18000
#      Sun Dec 09 21:23:34 2018 -0500
# Node ID 4b007df3bff23f32439e299d13ce1a808b857c4d
# Parent  e5b7d60068537baa1ffeeca4e1a81f7498d0d48e
py3: quote several instances of $PYTHON for Windows

Python3 lives in Program Files by default.  The last remaining unquoted instance
is in test-hghave.t.  I can't figure out how to quote that, as it either
complains:

    'c:\\Program' is not recognized as an internal or external command,
    operable program or batch file.

or

    $TESTTMP.sh: line 22: "C:/Program Files/Python37/python.exe": $ENOENT$

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -165,7 +165,7 @@ Check that extensions are loaded in phas
   > def custompredicate(repo, subset, x):
   >     return smartset.baseset([r for r in subset if r in {0}])
   > EOF
-  $ $PYTHON $TESTTMP/unflush.py foo.py
+  $ "$PYTHON" $TESTTMP/unflush.py foo.py
 
   $ cp foo.py bar.py
   $ echo 'foo = foo.py' >> $HGRCPATH
@@ -193,7 +193,7 @@ Check normal command's load order of ext
 Check hgweb's load order of extensions and registration of functions
 
   $ cat > hgweb.cgi <<EOF
-  > #!$PYTHON
+  > #!"$PYTHON"
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
@@ -264,7 +264,7 @@ limit mark, regardless of importing modu
   > def extsetup():
   >     print('ambigabs.s=%s' % ambigabs.s, flush=True)
   > NO_CHECK_EOF
-  $ $PYTHON $TESTTMP/unflush.py loadabs.py
+  $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
   $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
   ambigabs.s=libroot/ambig.py
   $TESTTMP/a
@@ -280,7 +280,7 @@ limit mark, regardless of importing modu
   > def extsetup():
   >     print('ambigrel.s=%s' % ambigrel.s, flush=True)
   > NO_CHECK_EOF
-  $ $PYTHON $TESTTMP/unflush.py loadrel.py
+  $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
   $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
   ambigrel.s=libroot/mod/ambig.py
   $TESTTMP/a
@@ -1825,7 +1825,7 @@ Prohibit the use of unicode strings as t
   > def ext(*args, **opts):
   >     print(opts[b'opt'], flush=True)
   > EOF
-  $ $PYTHON $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
+  $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
   $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
   > [extensions]
   > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
diff --git a/tests/test-filebranch.t b/tests/test-filebranch.t
--- a/tests/test-filebranch.t
+++ b/tests/test-filebranch.t
@@ -6,7 +6,7 @@ when we do a merge.
   > import sys, os
   > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
-  $ HGMERGE="$PYTHON ../merge"; export HGMERGE
+  $ HGMERGE="\"$PYTHON\" ../merge"; export HGMERGE
 
 Creating base:
 
diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -66,7 +66,7 @@ regardless of the commit message in the 
   new changesets 80971e65b431
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ HGEDITOR=cat hg --config ui.patch="$PYTHON ../dummypatch.py" --cwd b import --edit ../exported-tip.patch
+  $ HGEDITOR=cat hg --config ui.patch="\"$PYTHON\" ../dummypatch.py" --cwd b import --edit ../exported-tip.patch
   applying ../exported-tip.patch
   second change
   
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -11,7 +11,7 @@
   > 
   > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
-  $ HGMERGE="$PYTHON ../merge"; export HGMERGE
+  $ HGMERGE="\"$PYTHON\" ../merge"; export HGMERGE
 
   $ hg init t
   $ cd t


More information about the Mercurial-devel mailing list