From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#24464: 25.1; python.el virtualenv Date: Mon, 16 Oct 2017 21:24:24 -0400 Message-ID: <8760beh8hj.fsf@users.sourceforge.net> References: <87h96akmjn.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1508203530 25734 195.159.176.226 (17 Oct 2017 01:25:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2017 01:25:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: Pim , 24464@debbugs.gnu.org To: Justin Timmons Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 17 03:25:25 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4Gcz-0003nJ-DI for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Oct 2017 03:25:05 +0200 Original-Received: from localhost ([::1]:36013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Gd6-00023m-Hh for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 21:25:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Gd0-000227-2a for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 21:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Gcv-0003kC-Ty for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 21:25:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4Gcv-0003jz-Pr for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 21:25:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e4Gcv-0007YO-Kv for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 21:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Oct 2017 01:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24464-submit@debbugs.gnu.org id=B24464.150820347529002 (code B ref 24464); Tue, 17 Oct 2017 01:25:01 +0000 Original-Received: (at 24464) by debbugs.gnu.org; 17 Oct 2017 01:24:35 +0000 Original-Received: from localhost ([127.0.0.1]:44518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4GcV-0007Xi-6Q for submit@debbugs.gnu.org; Mon, 16 Oct 2017 21:24:35 -0400 Original-Received: from mail-io0-f173.google.com ([209.85.223.173]:50940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4GcT-0007XV-En for 24464@debbugs.gnu.org; Mon, 16 Oct 2017 21:24:33 -0400 Original-Received: by mail-io0-f173.google.com with SMTP id 97so494205iok.7 for <24464@debbugs.gnu.org>; Mon, 16 Oct 2017 18:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=gsn97GpaqCdAGqYsGMeQE8gt4nSXNGhwtsptXtt5J28=; b=ZssfgS51RxCDNHp/gQ0cfhjgr+QD5H3q5eU5MP1lMZOYEyvYua7lm3oMAkhYQqJtD3 yBG9IDN4km3SCgI1NOseXm+gBr3dbCzudH180qfWJ+1qSaaJKq+QAU17OenRi4Ti3Lv5 QRV4eJRPzCqd8cO0GHwKh2QwnNPi73bOZi58lGXHgjdg2tJ76kA/Tno+41qK8nsuiF2d TXauqhVPPbZffXJ5XDkb0mdU2yIdOuaIDXUdZZSvptemNbNQNKC2NYTf/RHfvoC8irw0 eYcF4oBhJBFFysKBaZzAOVVgNsx2Q9Lvq568+UzrWHIiUHEvatAE1XMS1jOwG36aAPM2 /Low== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=gsn97GpaqCdAGqYsGMeQE8gt4nSXNGhwtsptXtt5J28=; b=BKbQc6gchdmJAQalar8kOMgv9bBhC4bCOOMctZNz7o9KF9AzSfnbi/1HVyKanp6c6x sNDiZbchdF0wlnKljQ3hQ/cvmYCg1qjwPCB8N97AmyGoZ0qDLe+ox9EttVzAtY8G9v5u KXhkV4rBjvHCMW9qQEOlc4hpOCRU4B3QxnE782jxjK8kVnXA5nQTrutaXhAV0cEMt1qh v/3aAosSfH5Z0o7pMHqYQMq3TrltqHCAZooEg42X6Clj5JCLmVc5eFOE7VewTXsuqrq4 r40SrtayOEvmqqpbJUfToKd8NdnWRcbfkEZ1c2Ko1iRV818vfQ5G52SQE3EC+pfds7yc IPkw== X-Gm-Message-State: AMCzsaVSUfX3KeiGMGSL6XEm6xLpY+p0cT4nDcw/Xy24rC2nfKYLXfXt ToQSOLiG5VAl/2dOTtI7JDmyOA== X-Google-Smtp-Source: AOwi7QA++VGxzOLq6tVwWcLND7cympitXPomNexGon3Es0UNshaRlKBGTTwNGEUD/9o5xhZUGesmIA== X-Received: by 10.107.104.12 with SMTP id d12mr13984780ioc.296.1508203467554; Mon, 16 Oct 2017 18:24:27 -0700 (PDT) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id o204sm4165004ioe.63.2017.10.16.18.24.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2017 18:24:26 -0700 (PDT) In-Reply-To: <87h96akmjn.fsf@gmail.com> (Justin Timmons's message of "Sun, 11 Dec 2016 19:39:56 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138567 Archived-At: retitle 24464 python virtualenv support doesn't work on w32 quit Justin Timmons writes: > It looks like this was caused by an incorrect assumption on the > directory structure of the virtualenv directory. According to the > virtualenv docs only POSIX systems follow the structure > "/path/to/venv/bin/", while windows systems use "/path/to/venv/Scripts" > for the location of the binary files, most importantly including the > python interpreter (see: > https://virtualenv.pypa.io/en/stable/userguide/#windows-notes). > > This meant that the wrong path was added to `exec-path` and so we were > starting the python shell installed on the system, rather than the one > bundled inside of the virtualenv. > > This should be addressed in the attached patch file - it just adds a > special case for Windows and prepends that path to the system PATH. > > I also updated the docs for the `python-shell-calculate-exec-path` > function to make it more clear that using the python interpreter bundled > in the virtualenv will automatically set the PYTHONPATH to point at the > libraries inside of the virtualenv - something that was not immediately > obvious to me. > (defun python-shell-calculate-exec-path () > "Calculate `exec-path'. > Prepends `python-shell-exec-path' and adds the binary directory > -for virtualenv if `python-shell-virtualenv-root' is set. If > -`default-directory' points to a remote host, the returned value > -appends `python-shell-remote-exec-path' instead of `exec-path'." > +for virtualenv if `python-shell-virtualenv-root' is set - this > +will use the python interpreter from inside the virtualenv when > +starting the shell. If `default-directory' points to a remote host, > +the returned value appends `python-shell-remote-exec-path' instead > +of `exec-path'." > (let ((new-path (copy-sequence > (if (file-remote-p default-directory) > python-shell-remote-exec-path > - exec-path)))) > + exec-path))) > + > + ;; Windows and POSIX systems use different venv directory structures > + (virtualenv-bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin"))) > (python-shell--add-to-path-with-priority > new-path python-shell-exec-path) > (if (not python-shell-virtualenv-root) > new-path > (python-shell--add-to-path-with-priority > new-path > - (list (expand-file-name "bin" python-shell-virtualenv-root))) > + (list (expand-file-name virtualenv-bin-dir python-shell-virtualenv-root))) > new-path))) Looks good to me. Have you assigned copyright for Emacs? (The patch is small enough to go in regardless, I only ask to know if we should mark it.)