Skip to content

Commit 475f5a8

Browse files
committed
Add virtual_env
1 parent 1c5a1ae commit 475f5a8

File tree

6,914 files changed

+746322
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,914 files changed

+746322
-0
lines changed
Binary file not shown.

django_env/bin/activate

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This file must be used with "source bin/activate" *from bash*
2+
# you cannot run it directly
3+
4+
5+
if [ "${BASH_SOURCE-}" = "$0" ]; then
6+
echo "You must source this script: \$ source $0" >&2
7+
exit 33
8+
fi
9+
10+
deactivate () {
11+
unset -f pydoc >/dev/null 2>&1
12+
13+
# reset old environment variables
14+
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
15+
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
16+
PATH="$_OLD_VIRTUAL_PATH"
17+
export PATH
18+
unset _OLD_VIRTUAL_PATH
19+
fi
20+
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
21+
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
22+
export PYTHONHOME
23+
unset _OLD_VIRTUAL_PYTHONHOME
24+
fi
25+
26+
# This should detect bash and zsh, which have a hash command that must
27+
# be called to get it to forget past commands. Without forgetting
28+
# past commands the $PATH changes we made may not be respected
29+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
30+
hash -r 2>/dev/null
31+
fi
32+
33+
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
34+
PS1="$_OLD_VIRTUAL_PS1"
35+
export PS1
36+
unset _OLD_VIRTUAL_PS1
37+
fi
38+
39+
unset VIRTUAL_ENV
40+
if [ ! "${1-}" = "nondestructive" ] ; then
41+
# Self destruct!
42+
unset -f deactivate
43+
fi
44+
}
45+
46+
# unset irrelevant variables
47+
deactivate nondestructive
48+
49+
VIRTUAL_ENV="/home/ayaz/code/django-blog/django_env"
50+
export VIRTUAL_ENV
51+
52+
_OLD_VIRTUAL_PATH="$PATH"
53+
PATH="$VIRTUAL_ENV/bin:$PATH"
54+
export PATH
55+
56+
# unset PYTHONHOME if set
57+
if ! [ -z "${PYTHONHOME+_}" ] ; then
58+
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
59+
unset PYTHONHOME
60+
fi
61+
62+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
63+
_OLD_VIRTUAL_PS1="${PS1-}"
64+
if [ "x" != x ] ; then
65+
PS1="${PS1-}"
66+
else
67+
PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
68+
fi
69+
export PS1
70+
fi
71+
72+
# Make sure to unalias pydoc if it's already there
73+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
74+
75+
pydoc () {
76+
python -m pydoc "$@"
77+
}
78+
79+
# This should detect bash and zsh, which have a hash command that must
80+
# be called to get it to forget past commands. Without forgetting
81+
# past commands the $PATH changes we made may not be respected
82+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
83+
hash -r 2>/dev/null
84+
fi

django_env/bin/activate.csh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This file must be used with "source bin/activate.csh" *from csh*.
2+
# You cannot run it directly.
3+
# Created by Davide Di Blasi <[email protected]>.
4+
5+
set newline='\
6+
'
7+
8+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
9+
10+
# Unset irrelevant variables.
11+
deactivate nondestructive
12+
13+
setenv VIRTUAL_ENV "/home/ayaz/code/django-blog/django_env"
14+
15+
set _OLD_VIRTUAL_PATH="$PATH:q"
16+
setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
17+
18+
19+
20+
if ("" != "") then
21+
set env_name = ""
22+
else
23+
set env_name = '('"$VIRTUAL_ENV:t:q"') '
24+
endif
25+
26+
if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
27+
if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
28+
set do_prompt = "1"
29+
else
30+
set do_prompt = "0"
31+
endif
32+
else
33+
set do_prompt = "1"
34+
endif
35+
36+
if ( $do_prompt == "1" ) then
37+
# Could be in a non-interactive environment,
38+
# in which case, $prompt is undefined and we wouldn't
39+
# care about the prompt anyway.
40+
if ( $?prompt ) then
41+
set _OLD_VIRTUAL_PROMPT="$prompt:q"
42+
if ( "$prompt:q" =~ *"$newline:q"* ) then
43+
:
44+
else
45+
set prompt = "$env_name:q$prompt:q"
46+
endif
47+
endif
48+
endif
49+
50+
unset env_name
51+
unset do_prompt
52+
53+
alias pydoc python -m pydoc
54+
55+
rehash

django_env/bin/activate.fish

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2+
# Do not run it directly.
3+
4+
function _bashify_path -d "Converts a fish path to something bash can recognize"
5+
set fishy_path $argv
6+
set bashy_path $fishy_path[1]
7+
for path_part in $fishy_path[2..-1]
8+
set bashy_path "$bashy_path:$path_part"
9+
end
10+
echo $bashy_path
11+
end
12+
13+
function _fishify_path -d "Converts a bash path to something fish can recognize"
14+
echo $argv | tr ':' '\n'
15+
end
16+
17+
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
18+
# reset old environment variables
19+
if test -n "$_OLD_VIRTUAL_PATH"
20+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21+
if test (echo $FISH_VERSION | tr "." "\n")[1] -lt 3
22+
set -gx PATH (_fishify_path $_OLD_VIRTUAL_PATH)
23+
else
24+
set -gx PATH $_OLD_VIRTUAL_PATH
25+
end
26+
set -e _OLD_VIRTUAL_PATH
27+
end
28+
29+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
30+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
31+
set -e _OLD_VIRTUAL_PYTHONHOME
32+
end
33+
34+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
35+
and functions -q _old_fish_prompt
36+
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
37+
set -l fish_function_path
38+
39+
# Erase virtualenv's `fish_prompt` and restore the original.
40+
functions -e fish_prompt
41+
functions -c _old_fish_prompt fish_prompt
42+
functions -e _old_fish_prompt
43+
set -e _OLD_FISH_PROMPT_OVERRIDE
44+
end
45+
46+
set -e VIRTUAL_ENV
47+
48+
if test "$argv[1]" != 'nondestructive'
49+
# Self-destruct!
50+
functions -e pydoc
51+
functions -e deactivate
52+
functions -e _bashify_path
53+
functions -e _fishify_path
54+
end
55+
end
56+
57+
# Unset irrelevant variables.
58+
deactivate nondestructive
59+
60+
set -gx VIRTUAL_ENV "/home/ayaz/code/django-blog/django_env"
61+
62+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
63+
if test (echo $FISH_VERSION | tr "." "\n")[1] -lt 3
64+
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
65+
else
66+
set -gx _OLD_VIRTUAL_PATH $PATH
67+
end
68+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
69+
70+
# Unset `$PYTHONHOME` if set.
71+
if set -q PYTHONHOME
72+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
73+
set -e PYTHONHOME
74+
end
75+
76+
function pydoc
77+
python -m pydoc $argv
78+
end
79+
80+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
81+
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
82+
functions -c fish_prompt _old_fish_prompt
83+
84+
function fish_prompt
85+
# Save the current $status, for fish_prompts that display it.
86+
set -l old_status $status
87+
88+
# Prompt override provided?
89+
# If not, just prepend the environment name.
90+
if test -n ""
91+
printf '%s%s' "" (set_color normal)
92+
else
93+
printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
94+
end
95+
96+
# Restore the original $status
97+
echo "exit $old_status" | source
98+
_old_fish_prompt
99+
end
100+
101+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
102+
end

django_env/bin/activate.ps1

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file must be dot sourced from PoSh; you cannot run it directly. Do this: . ./activate.ps1
2+
3+
if (@($null,"Internal") -notcontains $myinvocation.commandorigin) {
4+
Write-Host -Foreground red "You must 'source' this script: PS> . $($myinvocation.invocationname)"
5+
exit 33
6+
}
7+
8+
$script:THIS_PATH = $myinvocation.mycommand.path
9+
$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent
10+
11+
function global:deactivate([switch] $NonDestructive) {
12+
if (Test-Path variable:_OLD_VIRTUAL_PATH) {
13+
$env:PATH = $variable:_OLD_VIRTUAL_PATH
14+
Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
15+
}
16+
17+
if (Test-Path function:_old_virtual_prompt) {
18+
$function:prompt = $function:_old_virtual_prompt
19+
Remove-Item function:\_old_virtual_prompt
20+
}
21+
22+
if ($env:VIRTUAL_ENV) {
23+
Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
24+
}
25+
26+
if (!$NonDestructive) {
27+
# Self destruct!
28+
Remove-Item function:deactivate
29+
Remove-Item function:pydoc
30+
}
31+
}
32+
33+
function global:pydoc {
34+
python -m pydoc $args
35+
}
36+
37+
# unset irrelevant variables
38+
deactivate -nondestructive
39+
40+
$VIRTUAL_ENV = $BASE_DIR
41+
$env:VIRTUAL_ENV = $VIRTUAL_ENV
42+
43+
New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
44+
45+
$env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH
46+
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
47+
function global:_old_virtual_prompt {
48+
""
49+
}
50+
$function:_old_virtual_prompt = $function:prompt
51+
52+
if ("" -ne "") {
53+
function global:prompt {
54+
# Add the custom prefix to the existing prompt
55+
$previous_prompt_value = & $function:_old_virtual_prompt
56+
("" + $previous_prompt_value)
57+
}
58+
}
59+
else {
60+
function global:prompt {
61+
# Add a prefix to the current prompt, but don't discard it.
62+
$previous_prompt_value = & $function:_old_virtual_prompt
63+
$new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) "
64+
($new_prompt_value + $previous_prompt_value)
65+
}
66+
}
67+
}

django_env/bin/activate.xsh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""Xonsh activate script for virtualenv"""
2+
from xonsh.tools import get_sep as _get_sep
3+
4+
def _deactivate(args):
5+
if "pydoc" in aliases:
6+
del aliases["pydoc"]
7+
8+
if ${...}.get("_OLD_VIRTUAL_PATH", ""):
9+
$PATH = $_OLD_VIRTUAL_PATH
10+
del $_OLD_VIRTUAL_PATH
11+
12+
if ${...}.get("_OLD_VIRTUAL_PYTHONHOME", ""):
13+
$PYTHONHOME = $_OLD_VIRTUAL_PYTHONHOME
14+
del $_OLD_VIRTUAL_PYTHONHOME
15+
16+
if "VIRTUAL_ENV" in ${...}:
17+
del $VIRTUAL_ENV
18+
19+
if "VIRTUAL_ENV_PROMPT" in ${...}:
20+
del $VIRTUAL_ENV_PROMPT
21+
22+
if "nondestructive" not in args:
23+
# Self destruct!
24+
del aliases["deactivate"]
25+
26+
27+
# unset irrelevant variables
28+
_deactivate(["nondestructive"])
29+
aliases["deactivate"] = _deactivate
30+
31+
$VIRTUAL_ENV = r"/home/ayaz/code/django-blog/django_env"
32+
33+
$_OLD_VIRTUAL_PATH = $PATH
34+
$PATH = $PATH[:]
35+
$PATH.add($VIRTUAL_ENV + _get_sep() + "bin", front=True, replace=True)
36+
37+
if ${...}.get("PYTHONHOME", ""):
38+
# unset PYTHONHOME if set
39+
$_OLD_VIRTUAL_PYTHONHOME = $PYTHONHOME
40+
del $PYTHONHOME
41+
42+
$VIRTUAL_ENV_PROMPT = ""
43+
if not $VIRTUAL_ENV_PROMPT:
44+
del $VIRTUAL_ENV_PROMPT
45+
46+
aliases["pydoc"] = ["python", "-m", "pydoc"]

0 commit comments

Comments
 (0)