Message373386
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. |
|
Date |
User |
Action |
Args |
2020-07-09 09:57:08 | kunaltyagi | set | recipients:
+ kunaltyagi |
2020-07-09 09:57:08 | kunaltyagi | set | messageid: <1594288628.21.0.90149093497.issue41256@roundup.psfhosted.org> |
2020-07-09 09:57:08 | kunaltyagi | link | issue41256 messages |
2020-07-09 09:57:08 | kunaltyagi | create | |
|