|
| 1 | +# Copyright (c) 2020-202x The virtualenv developers |
| 2 | +# |
| 3 | +# Permission is hereby granted, free of charge, to any person obtaining |
| 4 | +# a copy of this software and associated documentation files (the |
| 5 | +# "Software"), to deal in the Software without restriction, including |
| 6 | +# without limitation the rights to use, copy, modify, merge, publish, |
| 7 | +# distribute, sublicense, and/or sell copies of the Software, and to |
| 8 | +# permit persons to whom the Software is furnished to do so, subject to |
| 9 | +# the following conditions: |
| 10 | +# |
| 11 | +# The above copyright notice and this permission notice shall be |
| 12 | +# included in all copies or substantial portions of the Software. |
| 13 | +# |
| 14 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 15 | +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 16 | +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 17 | +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 18 | +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 19 | +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 20 | +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 21 | + |
| 22 | +# This file must be used with "source bin/activate" *from bash* |
| 23 | +# you cannot run it directly |
| 24 | + |
| 25 | +# Get script path (only used if environment is relocatable). |
| 26 | +if [ -n "${BASH_VERSION:+x}" ] ; then |
| 27 | + SCRIPT_PATH="${BASH_SOURCE[0]}" |
| 28 | + if [ "$SCRIPT_PATH" = "$0" ]; then |
| 29 | + # Only bash has a reasonably robust check for source'dness. |
| 30 | + echo "You must source this script: \$ source $0" >&2 |
| 31 | + exit 33 |
| 32 | + fi |
| 33 | +elif [ -n "${ZSH_VERSION:+x}" ] ; then |
| 34 | + SCRIPT_PATH="${(%):-%x}" |
| 35 | +elif [ -n "${KSH_VERSION:+x}" ] ; then |
| 36 | + SCRIPT_PATH="${.sh.file}" |
| 37 | +fi |
| 38 | + |
| 39 | +deactivate () { |
| 40 | + unset -f pydoc >/dev/null 2>&1 || true |
| 41 | + |
| 42 | + # reset old environment variables |
| 43 | + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all |
| 44 | + if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then |
| 45 | + PATH="$_OLD_VIRTUAL_PATH" |
| 46 | + export PATH |
| 47 | + unset _OLD_VIRTUAL_PATH |
| 48 | + fi |
| 49 | + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then |
| 50 | + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" |
| 51 | + export PYTHONHOME |
| 52 | + unset _OLD_VIRTUAL_PYTHONHOME |
| 53 | + fi |
| 54 | + |
| 55 | + # The hash command must be called to get it to forget past |
| 56 | + # commands. Without forgetting past commands the $PATH changes |
| 57 | + # we made may not be respected |
| 58 | + hash -r 2>/dev/null |
| 59 | + |
| 60 | + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then |
| 61 | + PS1="$_OLD_VIRTUAL_PS1" |
| 62 | + export PS1 |
| 63 | + unset _OLD_VIRTUAL_PS1 |
| 64 | + fi |
| 65 | + |
| 66 | + unset VIRTUAL_ENV |
| 67 | + unset VIRTUAL_ENV_PROMPT |
| 68 | + if [ ! "${1-}" = "nondestructive" ] ; then |
| 69 | + # Self destruct! |
| 70 | + unset -f deactivate |
| 71 | + fi |
| 72 | +} |
| 73 | + |
| 74 | +# unset irrelevant variables |
| 75 | +deactivate nondestructive |
| 76 | + |
| 77 | +VIRTUAL_ENV='C:\Users\niteris\dev\static-ffmpeg\.venv' |
| 78 | +if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then |
| 79 | + VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV") |
| 80 | +fi |
| 81 | +export VIRTUAL_ENV |
| 82 | + |
| 83 | +_OLD_VIRTUAL_PATH="$PATH" |
| 84 | +PATH="$VIRTUAL_ENV/Scripts:$PATH" |
| 85 | +export PATH |
| 86 | + |
| 87 | +if [ "xstatic-ffmpeg" != x ] ; then |
| 88 | + VIRTUAL_ENV_PROMPT="(static-ffmpeg) " |
| 89 | +else |
| 90 | + VIRTUAL_ENV_PROMPT="($(basename "$VIRTUAL_ENV")) " |
| 91 | +fi |
| 92 | +export VIRTUAL_ENV_PROMPT |
| 93 | + |
| 94 | +# unset PYTHONHOME if set |
| 95 | +if ! [ -z "${PYTHONHOME+_}" ] ; then |
| 96 | + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" |
| 97 | + unset PYTHONHOME |
| 98 | +fi |
| 99 | + |
| 100 | +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then |
| 101 | + _OLD_VIRTUAL_PS1="${PS1-}" |
| 102 | + PS1="${VIRTUAL_ENV_PROMPT}${PS1-}" |
| 103 | + export PS1 |
| 104 | +fi |
| 105 | + |
| 106 | +# Make sure to unalias pydoc if it's already there |
| 107 | +alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true |
| 108 | + |
| 109 | +pydoc () { |
| 110 | + python -m pydoc "$@" |
| 111 | +} |
| 112 | + |
| 113 | +# The hash command must be called to get it to forget past |
| 114 | +# commands. Without forgetting past commands the $PATH changes |
| 115 | +# we made may not be respected |
| 116 | +hash -r 2>/dev/null |
0 commit comments