all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zhongwei Yao <ashi08104@gmail.com>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to let tramp be aware the virtualenv?
Date: Wed, 17 Jul 2019 10:02:57 +0800	[thread overview]
Message-ID: <CAJnfWeEh1_j9F3p=G4vAFo6RFaNvXSGMhO7bcj6HwPF_r0N93Q@mail.gmail.com> (raw)
In-Reply-To: <5d2e15b2.1c69fb81.02bd.de51@mx.google.com>

Hi, Bruno,
Thanks, but it still doesn't work. (I use ssh to connect to the remote
Ubuntu server. And the /bin/sh is dash, so "source" does work. I replace it
with ".").

For example, when I run "echo $BASH_VERSION" in compilation command by
tramp, it is empty.

By using " RemoteCommand sh -c '. my/python/virtualenv/bin/activate; bash
-l'", I think all command will run in bash, right? Am I missing something?

Thanks,
Zhongwei

On Wed, Jul 17, 2019 at 2:21 AM Bruno Barbier <brubar.cs@gmail.com> wrote:

>
> Hi Zhongwei,
>
>
> Zhongwei Yao <ashi08104@gmail.com> writes:
>
> > Hi, all,
> > I try to use tramp on a remote project directory and run "M-x compile".
> The
> > command requires to know which the python virtualenv is active.
> >
> > I try to let tramp be ware of which virtualenv is active by adding a line
> > to the remote $HOME/.profile like (because it seems tramp will run the
> > compilation command by the remote /bin/sh):
> >
> >   source my/python/virtualenv/bin/activate.
> >
> > But tramp seems doesn't read that line at all. The virtualenv is not
> > activated.
> >
> > So how can I make tramp aware of which virtualenv is enabled?
> >
> > Thanks!
> > Zhongwei
>
> Are you using SSH to connect ?
>
> If so, you might be able to configure SSH to do it.
>
> In your ~/.ssh/config (or where your ssh config is), add something like
> this:
>
>   Host a-nice-and-very-short-name
>        HostName 169.254.1.2
>        RequestTTy force
>        RemoteCommand sh -c 'source my/python/virtualenv/bin/activate; bash
> -l'
>
>
> Then, using tramp, it should just work:
>
>   /ssh:a-nice-and-very-short-name:/path/to/your-project
>
>
> Bruno
>
>
>
>


  reply	other threads:[~2019-07-17  2:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 10:30 How to let tramp be aware the virtualenv? Zhongwei Yao
2019-07-16 13:48 ` Michael Albinus
2019-07-16 19:22 ` Bruno Barbier
2019-07-17  2:02   ` Zhongwei Yao [this message]
2019-07-17  6:12     ` Michael Albinus
2019-07-17 10:47       ` Zhongwei Yao
2019-07-17 11:34         ` Michael Albinus
2019-07-17 13:40           ` Zhongwei Yao
2019-07-17 14:05             ` Michael Albinus
2019-07-17 16:02             ` Yuri Khan
2019-07-17 21:02             ` Bruno Barbier
2019-07-18 13:21               ` Zhongwei Yao
2019-07-18 17:45                 ` Bruno Barbier
2019-07-19  1:04                   ` Zhongwei Yao

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='CAJnfWeEh1_j9F3p=G4vAFo6RFaNvXSGMhO7bcj6HwPF_r0N93Q@mail.gmail.com' \
    --to=ashi08104@gmail.com \
    --cc=brubar.cs@gmail.com \
    --cc=help-gnu-emacs@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.