From 81abec91eed06fd2d2d37388bba2fb451991abcd Mon Sep 17 00:00:00 2001 From: "Emilio C. Lopes" Date: Mon, 28 Jul 2014 21:08:43 +0200 Subject: [PATCH] * net/tramp-sh.el (tramp-get-remote-python): Also search for executables named "python2" or "python3". (tramp-get-remote-uid-with-python): Use parentheses around arguments to `print' to make it compatible with Python 3. (tramp-get-remote-gid-with-python): Ditto. Fixes: debbugs:18118 --- lisp/ChangeLog | 10 +++++++++- lisp/net/tramp-sh.el | 12 +++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1d00a180e9c..776c6600694 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,12 @@ -2014-07-28 Eli Zaretskii +2014-07-28 Emilio C. Lopes + + * net/tramp-sh.el (tramp-get-remote-python): Also search for + executables named "python2" or "python3". + (tramp-get-remote-uid-with-python): Use parentheses around + arguments to `print' to make it compatible with Python 3. + (tramp-get-remote-gid-with-python): Ditto. (Bug#18118) + +22014-07-28 Eli Zaretskii * window.el (window--pixel-to-total): Use FRAME's root window, not that of the selected frame. (Bug#18112, Bug#16674) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 315bc08d0ef..e234162bd4a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5256,7 +5256,9 @@ Return ATTR." (defun tramp-get-remote-python (vec) (with-tramp-connection-property vec "python" (tramp-message vec 5 "Finding a suitable `python' command") - (tramp-find-executable vec "python" (tramp-get-remote-path vec)))) + (or (tramp-find-executable vec "python" (tramp-get-remote-path vec)) + (tramp-find-executable vec "python2" (tramp-get-remote-path vec)) + (tramp-find-executable vec "python3" (tramp-get-remote-path vec))))) (defun tramp-get-remote-uid-with-python (vec id-format) (tramp-send-command-and-read @@ -5264,8 +5266,8 @@ Return ATTR." (format "%s -c \"%s\"" (tramp-get-remote-python vec) (if (equal id-format 'integer) - "import os; print os.getuid()" - "import os, pwd; print '\\\"' + pwd.getpwuid(os.getuid())[0] + '\\\"'")))) + "import os; print (os.getuid())" + "import os, pwd; print ('\\\"' + pwd.getpwuid(os.getuid())[0] + '\\\"')")))) (defun tramp-get-remote-uid (vec id-format) (with-tramp-connection-property vec (format "uid-%s" id-format) @@ -5305,8 +5307,8 @@ Return ATTR." (format "%s -c \"%s\"" (tramp-get-remote-python vec) (if (equal id-format 'integer) - "import os; print os.getgid()" - "import os, grp; print '\\\"' + grp.getgrgid(os.getgid())[0] + '\\\"'")))) + "import os; print (os.getgid())" + "import os, grp; print ('\\\"' + grp.getgrgid(os.getgid())[0] + '\\\"')")))) (defun tramp-get-remote-gid (vec id-format) (with-tramp-connection-property vec (format "gid-%s" id-format) -- 2.39.2