all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: eclig@gmx.net
To: 18118@debbugs.gnu.org
Subject: bug#18118: Support for Python3 in TRAMP's `tramp-get-remote-uid-with-python'
Date: Sun, 27 Jul 2014 16:32:31 +0200	[thread overview]
Message-ID: <87ppgqan40.fsf@gmx.net> (raw)

Dear Emacs maintainers,

the following patch makes possible to use TRAMP to connect to systems
where both `perl' and `id' are missing and where the Python program is
called `python3'.  Note that the syntax `print foo' is invalid in
Python3 since there `print' is a function, whereas in Python2 it is/was
a statement.  The syntax `print(foo)' works in both cases and it's what
I used bellow.

Regards

 Emílio

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: eclig@gmx.net-20140725151222-n88affhi3m98xkqr
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk/
# testament_sha1: cbaad612600a8166a622e1019484b64d24afeae9
# timestamp: 2014-07-25 17:17:36 +0200
# base_revision_id: eliz@gnu.org-20140725115836-axkqeojeljgzzef1
#
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog    2014-07-25 09:37:07 +0000
+++ lisp/ChangeLog    2014-07-25 15:12:22 +0000
@@ -1,3 +1,11 @@
+2014-07-25  Emilio C. Lopes  <eclig@gmx.net>
+
+    * 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.
+
 2014-07-25  Glenn Morris  <rgm@gnu.org>
 
     * vc/ediff-init.el (ediff-toggle-read-only-function):

=== modified file 'lisp/net/tramp-sh.el'
--- lisp/net/tramp-sh.el    2014-07-03 09:27:02 +0000
+++ lisp/net/tramp-sh.el    2014-07-25 15:12:22 +0000
@@ -5256,7 +5256,9 @@
 (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 @@
    (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 @@
    (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)

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfkFh8UAAqlfgGwwUP///34E
Qk7////wUAWWW8u7ptYW4C1oapoSUQJG9AmmEGjIaAk9J6gADQDQSiCYmTIKntU2NSPU0DQAAAaA
ASQgphE8gKG9KDJtQAGgDIxA0OaMmJgAmIwI0wIMRgmTAIwSKRpNoEp5T9J6A1CekyPRGEAaABkv
IKokECJoYjfp9u07V7UnMhGJDjv3lTZ6cVbdggtEra1nvrKN9HppQh9gMdcvgfFscjsOJiO4vxzm
8gzcrAzJurpVkW6mcbXMlJ6OtrTZ6Tg16eGQ0d06ZSnugtfkQ6v7zdMOUKak+llA4sLvEE5uSShK
nCKWRegyvm0Z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wTft+NixDMyYt+k2VWIr9aRuQVIlAKN5oBg6hEDU4qLV+2B3S15QMeK9VKWqwfyNOFy
WRCgRVATHdWkTRbBbAGrFRXECfPzgUMnoXsKcNQRRck2jptCYObfvmIFLy1Bo/uo7S1bl0CrGhrs
dJSW6Oi5HEE67ETKJMGMksbNMAnZpZMmDUpIomCzjoHbUmQXZWAwwDkXENLqdukZjBEU5kSEuaM9
SUALea1Zg3ynbw1Cor4idSYUYGCjgan2S7brozlxCe82IZJdT7eWMikWnAM8dYTUIGwJ2QPSGcM/
lSmotzhbJVxTVXOkTSZZcSVViKVVuW5i9+LcSpgSEQ1u8GhTjHq7tGSXFgHfvDIJ9Ro6RWkDlJeH
kCO1IkGlbgIIvpZbw8ZJNmZSZ6E5aF/xdyRThQkPkFh8UA==






             reply	other threads:[~2014-07-27 14:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-27 14:32 eclig [this message]
2014-07-28 19:11 ` bug#18118: Support for Python3 in TRAMP's `tramp-get-remote-uid-with-python' Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppgqan40.fsf@gmx.net \
    --to=eclig@gmx.net \
    --cc=18118@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.