-
Notifications
You must be signed in to change notification settings - Fork 20
failing to source virtualenvwrapper on alpine linux (ash) #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
May be the same issue as with fish shell however I've not tried it there. Just guessing from the surrounding code. |
That still won't help your shell, though, because without a default Really, using |
Although, interestingly, when sourcing a script it seems that so I guess the first question is, if you save this script to a file echo "0: $0"
echo "BASH_SOURCE: ${BASH_SOURCE}"
echo "ZSH_ARGZERO: ${ZSH_ARGZERO}"
echo "ZSH_SCRIPT: ${ZSH_SCRIPT}"
# Feel free to add any additional variables
# your shell's documentation indicates might be useful. Then what do you get in
Here's what I getZsh$ zsh test_arg0.sh
0: test_arg0.sh
BASH_SOURCE:
ZSH_ARGZERO: test_arg0.sh
ZSH_SCRIPT: test_arg0.sh
$ source test_arg0.sh
0: test_arg0.sh
BASH_SOURCE:
ZSH_ARGZERO: zsh
ZSH_SCRIPT: Bash$ bash test_arg0.sh
0: test_arg0.sh
BASH_SOURCE: test_arg0.sh
ZSH_ARGZERO:
ZSH_SCRIPT:
$ source test_arg0.sh
0: bash
BASH_SOURCE: test_arg0.sh
ZSH_ARGZERO:
ZSH_SCRIPT: |
- `${.sh.file}` was ksh syntax, but ksh support was dropped in commit d736549 - Instead of testing only for certain specific shells (and excluding all others), use `$BASH_SOURCE` if it's set, otherwise fall back to `$0` which should work with more shells (hopefully). Fixes python-virtualenvwrapper#105
I don't think fish is ever gonna work. It dumps out with an error anytime a variable reference uses curly braces! (What are they THINKING??) $ source test_arg0.sh
test_arg0.sh (line 2): Variables cannot be bracketed. In fish, please use "$BASH_SOURCE".
echo "BASH_SOURCE: ${BASH_SOURCE}" |
I think there's an alternative implementation for fish. I've never heard of the ash shell. If its syntax can be supported without breaking anything, I could review patches. |
- `${.sh.file}` was ksh syntax, but ksh support was dropped in commit d736549 - Instead of testing only for certain specific shells (and excluding all others), use `$BASH_SOURCE` if it's set, otherwise fall back to `$0` which should work with more shells (hopefully). Fixes python-virtualenvwrapper#105
I just remembered that alpine publishes docker containers, which makes it really easy to test the $ docker pull alpine:latest
$ docker run -t -i alpine:latest /bin/ash
/ # cat > test_arg0.sh
echo "0: $0"
echo "BASH_SOURCE: ${BASH_SOURCE}"
echo "ZSH_ARGZERO: ${ZSH_ARGZERO}"
echo "ZSH_SCRIPT: ${ZSH_SCRIPT}"
/ # source test_arg0.sh
0: /bin/ash
BASH_SOURCE:
ZSH_ARGZERO:
ZSH_SCRIPT: Conclusion: None of the existing methods will work for Ash. Looking at the man page, I don't see any documented method of determining the path where a sourced script is located. |
Ah, crap, that's my fault, I shouldn't have marked that PR as "fixes" this issue, since it doesn't. ...Thanks, you beat me to it. |
I've posted a StackExchange question asking how this might be solved. |
Hi, currently the virtualenvwrapper.sh script fails to be sourced on alpine linux.
This line of code
virtualenvwrapper/virtualenvwrapper.sh
Line 106 in c0f5193
currently causes
-ash: /usr/bin/virtualenvwrapper.sh: line 109: syntax error: bad substitution
when using the ash shell on alpine linux.The text was updated successfully, but these errors were encountered: