classification
Title: Install bash activate script on Windows when using venv
Type: enhancement Stage: test needed
Components: Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: Brandon VanVaerenbergh - NOAA Affiliate, evan_, marfire, ncoghlan, paul.moore, vinay.sajip
Priority: normal Keywords: patch

Created on 2014-09-05 20:24 by marfire, last changed 2017-01-13 10:19 by vinay.sajip. This issue is now closed.

Files
File name Uploaded Description Edit
activate.diff paul.moore, 2015-04-06 18:58 review
Messages (12)
msg226452 - (view) Author: Kevin Christopher Henry (marfire) Date: 2014-09-05 20:24
When I use venv to create a new virtual environment in Windows I'm given two activate scripts, a .bat file and a .ps1 file (which is consistent with the documentation).

However, bash (and probably the other shells as well) works just fine in Windows under Cygwin. Since you have these scripts anyway, please include them in the Windows virtual environment (as virtualenv did).
msg226483 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-09-06 10:45
+1 from me - Vinay?
msg226504 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-09-06 19:11
I have no particular objection to this, and it's not a lot of work to make it happen. The POSIX scripts were left out in case the opposite view was advanced - that these scripts would be of no use to most people on Windows, and shouldn't be there cluttering up the place :-)
msg240170 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2015-04-06 18:58
Presumably this would just be a case of moving "activate" from venv/scripts/posix to venv/scripts/common? I don't think including csh or fish scripts on Windows is worthwhile...

Attached is a patch on that basis. I didn't see any tests for which scripts were installed, so I don't think there's anything to change there.
msg282741 - (view) Author: Brandon VanVaerenbergh (Brandon VanVaerenbergh - NOAA Affiliate) Date: 2016-12-08 21:51
+1 just experienced this issue migrating from Python3.4 to Python3.5 on windows with bash (MINGW git bash) as primary shell

Temporarily resolved issue (on this workstation) by simply copying Python35\Lib\venv\scripts\posix\activate file, into folder: Python35\Lib\venv\scripts\nt\

then recreating venv
msg283538 - (view) Author: Evan Andrews (evan_) * Date: 2016-12-18 05:38
+1, I'm also using Windows with Git Bash and venv is unusable for me without Brandon's workaround.
msg285255 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2017-01-11 18:26
If we do this, the activate script will have LF (POSIX) line endings on Windows. Will this work for things like cygwin, Git-bash etc?
msg285286 - (view) Author: Kevin Christopher Henry (marfire) Date: 2017-01-12 04:32
I can confirm that LF endings work fine on Cygwin, and it's hard to imagine any bash implementation not handling that properly.
msg285304 - (view) Author: Evan Andrews (evan_) * Date: 2017-01-12 11:08
Works for me in Git Bash.
msg285335 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2017-01-12 17:20
I've pushed the changes, but due to some SMTP problem this issue wasn't updated by Roundup:

remote: SMTPServerDisconnected: Connection unexpectedly closed: timed out
remote: error: changegroup.roundup hook raised an exception: Connection unexpectedly closed: timed out

However, the changes appear to be in the repository. Interested parties might want to pull the changes and test things out on Windows so that the issue can be closed.
msg285336 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2017-01-12 17:22
Changesets:

3.5     d6ae934da199
3.6     8f77c4f93806
default 7afe82ad34e7
msg285369 - (view) Author: Evan Andrews (evan_) * Date: 2017-01-13 08:32
Works for me on the master branch. Thanks, Vinay.
History
Date User Action Args
2017-01-13 10:19:04vinay.sajipsetstatus: open -> closed
assignee: vinay.sajip
resolution: fixed
2017-01-13 08:32:24evan_setmessages: + msg285369
2017-01-12 17:22:45vinay.sajipsetmessages: + msg285336
2017-01-12 17:20:46vinay.sajipsetmessages: + msg285335
2017-01-12 11:08:55evan_setmessages: + msg285304
2017-01-12 04:32:18marfiresetmessages: + msg285286
2017-01-11 18:26:14vinay.sajipsetmessages: + msg285255
2016-12-18 05:38:06evan_setnosy: + evan_
messages: + msg283538
2016-12-08 21:51:45Brandon VanVaerenbergh - NOAA Affiliatesetnosy: + Brandon VanVaerenbergh - NOAA Affiliate

messages: + msg282741
versions: + Python 3.6, Python 3.7
2015-04-06 18:58:08paul.mooresetfiles: + activate.diff

nosy: + paul.moore
messages: + msg240170

keywords: + patch
2014-09-12 20:08:24terry.reedysetstage: test needed
versions: + Python 3.5, - Python 3.4
2014-09-06 19:11:14vinay.sajipsetmessages: + msg226504
2014-09-06 10:45:19ncoghlansetmessages: + msg226483
2014-09-06 02:37:27ned.deilysetnosy: + vinay.sajip, ncoghlan
2014-09-05 20:24:08marfirecreate