summaryrefslogtreecommitdiffstats
path: root/ssh.py
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2011-02-07 00:32:16 -0800
committerAvery Pennarun <apenwarr@gmail.com>2011-02-07 17:18:30 -0800
commit1ca8aa5b891d01181a5d6a814631f6cf2cd08603 (patch)
tree623789207f26162fe8ab48769d09fe3fc5d9dfc9 /ssh.py
parenta62975e0cebc41e4c4bb83571a83ebd0bf699763 (diff)
server: workaround for idiotic ArchLinux renaming of python to python2.
First try running under python2, then python if that doesn't exist.
Diffstat (limited to 'ssh.py')
-rw-r--r--ssh.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ssh.py b/ssh.py
index 9a6270a..c7be991 100644
--- a/ssh.py
+++ b/ssh.py
@@ -73,16 +73,23 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
if not rhost:
- argv = [python, '-c', pyscript]
+ # ignore the --python argument when running locally; we already know
+ # which python version works.
+ argv = [sys.argv[1], '-c', pyscript]
else:
if ssh_cmd:
sshl = ssh_cmd.split(' ')
else:
sshl = ['ssh']
+ if python:
+ pycmd = "'%s' -c '%s'" % (python, pyscript)
+ else:
+ pycmd = ("P=python2; $P -V 2>/dev/null || P=python; "
+ "\"$P\" -c '%s'") % pyscript
argv = (sshl +
portl +
ipv6flag +
- [rhost, '--', "'%s' -c '%s'" % (python, pyscript)])
+ [rhost, '--', pycmd])
(s1,s2) = socket.socketpair()
def setup():
# runs in the child process