This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kunaltyagi
Recipients kunaltyagi
Date 2020-07-09.09:57:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594288628.21.0.90149093497.issue41256@roundup.psfhosted.org>
In-reply-to
Content
TLDR: `activate` script should be able to:
* inform user if it has been run and not sourced
* act as a placeholder to detect the shell being used and source the necessary `activate.{SHELL}` instead of throwing an error

---
It's mildly infuriating that `activate` on different setups needs to be called differently. The lack of messages when it's not sourced is also beginner unfriendly.

Both the issues are relatively easy to fix. First, making it shell agnostic. We can move the contents of `activate` to `activate.sh` and change `activate` to contain code like:
```sh
[ $FISH_VERSION ] && . activate.fish
[ $BASH_VERSION ] && . activate.sh
...
```

This of course will fail hard when you try to `. <venv_location>/bin/activate`. Finding the path of the file is not trivial, but doable. If we assume `dirname` is not present on the system, we can use `<full_path>/activate.<SHELL>`.

Making the "sourced or ran" logic shell agnostic is slightly easier to accomplish due to `$_`, `$0`, `$BASH_SOURCE`.

It'll possibly take a non-trivial amount of code to accomplish something this trivial, but it'll save people with custom shells 3 keystrokes and make the workflow smoother.
History
Date User Action Args
2020-07-09 09:57:08kunaltyagisetrecipients: + kunaltyagi
2020-07-09 09:57:08kunaltyagisetmessageid: <1594288628.21.0.90149093497.issue41256@roundup.psfhosted.org>
2020-07-09 09:57:08kunaltyagilinkissue41256 messages
2020-07-09 09:57:08kunaltyagicreate