Erste Version
This commit is contained in:
commit
782b1850a3
1641 files changed
+512713
No files matched your search
@@ -0,0 +1,132 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
|
||||
if [ "${BASH_SOURCE-}" = "$0" ]; then
|
||||
echo "You must source this script: \$ source $0" >&2
|
||||
exit 33
|
||||
fi
|
||||
|
||||
deactivate () {
|
||||
unset -f pydoc >/dev/null 2>&1 || true
|
||||
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="$_OLD_VIRTUAL_PATH"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_TCL_LIBRARY:-}" ]; then
|
||||
TCL_LIBRARY="$_OLD_VIRTUAL_TCL_LIBRARY"
|
||||
export TCL_LIBRARY
|
||||
unset _OLD_VIRTUAL_TCL_LIBRARY
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_TK_LIBRARY:-}" ]; then
|
||||
TK_LIBRARY="$_OLD_VIRTUAL_TK_LIBRARY"
|
||||
export TK_LIBRARY
|
||||
unset _OLD_VIRTUAL_TK_LIBRARY
|
||||
fi
|
||||
if [ -n "${_OLD_PKG_CONFIG_PATH:-}" ]; then
|
||||
PKG_CONFIG_PATH="$_OLD_PKG_CONFIG_PATH"
|
||||
export PKG_CONFIG_PATH
|
||||
unset _OLD_PKG_CONFIG_PATH
|
||||
fi
|
||||
|
||||
# The hash command must be called to get it to forget past
|
||||
# commands. Without forgetting past commands the $PATH changes
|
||||
# we made may not be respected
|
||||
hash -r 2>/dev/null
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="$_OLD_VIRTUAL_PS1"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
unset VIRTUAL_ENV_PROMPT
|
||||
if [ ! "${1-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
if [ ! -d /home/zlata/PycharmProjects/Funktional/.venv ]; then
|
||||
echo "Virtual environment directory /home/zlata/PycharmProjects/Funktional/.venv does not exist!" >&2
|
||||
CURRENT_PATH=$(realpath "${0}")
|
||||
CURRENT_DIR=$(dirname "${CURRENT_PATH}")
|
||||
VIRTUAL_ENV="$(realpath "${CURRENT_DIR}/../")"
|
||||
else
|
||||
VIRTUAL_ENV=/home/zlata/PycharmProjects/Funktional/.venv
|
||||
fi
|
||||
|
||||
case "$(uname)" in
|
||||
CYGWIN*|MSYS*|MINGW*)
|
||||
VIRTUAL_ENV=$(cygpath "$VIRTUAL_ENV")
|
||||
;;
|
||||
esac
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/"bin":$PATH"
|
||||
export PATH
|
||||
|
||||
_OLD_PKG_CONFIG_PATH="${PKG_CONFIG_PATH:-}"
|
||||
PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
if [ "x"'' != x ] ; then
|
||||
VIRTUAL_ENV_PROMPT=''
|
||||
else
|
||||
VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
|
||||
fi
|
||||
export VIRTUAL_ENV_PROMPT
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ '' != "" ]; then
|
||||
if [ -n "${TCL_LIBRARY:-}" ] ; then
|
||||
_OLD_VIRTUAL_TCL_LIBRARY="$TCL_LIBRARY"
|
||||
fi
|
||||
TCL_LIBRARY=''
|
||||
export TCL_LIBRARY
|
||||
fi
|
||||
|
||||
if [ '' != "" ]; then
|
||||
if [ -n "${TK_LIBRARY:-}" ] ; then
|
||||
_OLD_VIRTUAL_TK_LIBRARY="$TK_LIBRARY"
|
||||
fi
|
||||
TK_LIBRARY=''
|
||||
export TK_LIBRARY
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1-}"
|
||||
PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# Make sure to unalias pydoc if it's already there
|
||||
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
|
||||
|
||||
pydoc () {
|
||||
python -m pydoc "$@"
|
||||
}
|
||||
|
||||
# The hash command must be called to get it to forget past
|
||||
# commands. Without forgetting past commands the $PATH changes
|
||||
# we made may not be respected
|
||||
hash -r 2>/dev/null || true
|
||||
@@ -0,0 +1,74 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
|
||||
set newline='\
|
||||
'
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_TCL_LIBRARY != 0 && setenv TCL_LIBRARY "$_OLD_VIRTUAL_TCL_LIBRARY:q" && unset _OLD_VIRTUAL_TCL_LIBRARY || unsetenv TCL_LIBRARY; test $?_OLD_VIRTUAL_TK_LIBRARY != 0 && setenv TK_LIBRARY "$_OLD_VIRTUAL_TK_LIBRARY:q" && unset _OLD_VIRTUAL_TK_LIBRARY || unsetenv TK_LIBRARY; test $?_OLD_PKG_CONFIG_PATH != 0 && setenv PKG_CONFIG_PATH "$_OLD_PKG_CONFIG_PATH:q" && unset _OLD_PKG_CONFIG_PATH || unsetenv PKG_CONFIG_PATH; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV /home/zlata/PycharmProjects/Funktional/.venv
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH:q"
|
||||
setenv PATH "$VIRTUAL_ENV:q/"bin":$PATH:q"
|
||||
|
||||
if ($?PKG_CONFIG_PATH) then
|
||||
set _OLD_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
|
||||
setenv PKG_CONFIG_PATH "${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}"
|
||||
else
|
||||
setenv PKG_CONFIG_PATH "${VIRTUAL_ENV}/lib/pkgconfig"
|
||||
endif
|
||||
|
||||
if ('' != "") then
|
||||
if ($?TCL_LIBRARY) then
|
||||
set _OLD_VIRTUAL_TCL_LIBRARY="$TCL_LIBRARY"
|
||||
endif
|
||||
setenv TCL_LIBRARY ''
|
||||
endif
|
||||
|
||||
if ('' != "") then
|
||||
if ($?TK_LIBRARY) then
|
||||
set _OLD_VIRTUAL_TK_LIBRARY="$TK_LIBRARY"
|
||||
endif
|
||||
setenv TK_LIBRARY ''
|
||||
endif
|
||||
|
||||
if ('' != "") then
|
||||
setenv VIRTUAL_ENV_PROMPT ''
|
||||
else
|
||||
setenv VIRTUAL_ENV_PROMPT "$VIRTUAL_ENV:t:q"
|
||||
endif
|
||||
|
||||
if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
|
||||
if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
|
||||
set do_prompt = "1"
|
||||
else
|
||||
set do_prompt = "0"
|
||||
endif
|
||||
else
|
||||
set do_prompt = "1"
|
||||
endif
|
||||
|
||||
if ( $do_prompt == "1" ) then
|
||||
# Could be in a non-interactive environment,
|
||||
# in which case, $prompt is undefined and we wouldn't
|
||||
# care about the prompt anyway.
|
||||
if ( $?prompt ) then
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt:q"
|
||||
if ( "$prompt:q" =~ *"$newline:q"* ) then
|
||||
:
|
||||
else
|
||||
set prompt = '('"$VIRTUAL_ENV_PROMPT:q"') '"$prompt:q"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
unset env_name
|
||||
unset do_prompt
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
@@ -0,0 +1,118 @@
|
||||
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
|
||||
# Do not run it directly.
|
||||
|
||||
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
|
||||
if test -n ''
|
||||
if test -n "$_OLD_VIRTUAL_TCL_LIBRARY";
|
||||
set -gx TCL_LIBRARY "$_OLD_VIRTUAL_TCL_LIBRARY";
|
||||
set -e _OLD_VIRTUAL_TCL_LIBRARY;
|
||||
else;
|
||||
set -e TCL_LIBRARY;
|
||||
end
|
||||
end
|
||||
if test -n ''
|
||||
if test -n "$_OLD_VIRTUAL_TK_LIBRARY";
|
||||
set -gx TK_LIBRARY "$_OLD_VIRTUAL_TK_LIBRARY";
|
||||
set -e _OLD_VIRTUAL_TK_LIBRARY;
|
||||
else;
|
||||
set -e TK_LIBRARY;
|
||||
end
|
||||
end
|
||||
|
||||
if test -n "$_OLD_PKG_CONFIG_PATH"
|
||||
set -gx PKG_CONFIG_PATH "$_OLD_PKG_CONFIG_PATH"
|
||||
set -e _OLD_PKG_CONFIG_PATH
|
||||
end
|
||||
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
and functions -q _old_fish_prompt
|
||||
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
|
||||
set -l fish_function_path
|
||||
|
||||
# Erase virtualenv's `fish_prompt` and restore the original.
|
||||
functions -e fish_prompt
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
set -e VIRTUAL_ENV_PROMPT
|
||||
|
||||
if test "$argv[1]" != 'nondestructive'
|
||||
# Self-destruct!
|
||||
functions -e pydoc
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV /home/zlata/PycharmProjects/Funktional/.venv
|
||||
|
||||
set -gx _OLD_PKG_CONFIG_PATH "$PKG_CONFIG_PATH"
|
||||
set -gx PKG_CONFIG_PATH "$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV"'/'bin $PATH
|
||||
|
||||
if test -n ''
|
||||
if set -q TCL_LIBRARY;
|
||||
set -gx _OLD_VIRTUAL_TCL_LIBRARY $TCL_LIBRARY;
|
||||
end
|
||||
set -gx TCL_LIBRARY ''''
|
||||
end
|
||||
if test -n ''
|
||||
if set -q TK_LIBRARY;
|
||||
set -gx _OLD_VIRTUAL_TK_LIBRARY $TK_LIBRARY;
|
||||
end
|
||||
set -gx TK_LIBRARY ''''
|
||||
end
|
||||
|
||||
# Prompt override provided?
|
||||
# If not, just use the environment name.
|
||||
if test -n ''
|
||||
set -gx VIRTUAL_ENV_PROMPT ''
|
||||
else
|
||||
set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
|
||||
end
|
||||
|
||||
# Unset `$PYTHONHOME` if set.
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
function pydoc
|
||||
python -m pydoc $argv
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
function fish_prompt
|
||||
set -l old_status $status
|
||||
# Run the user's prompt first; it might depend on (pipe)status.
|
||||
set -l prompt (_old_fish_prompt)
|
||||
|
||||
printf '(%s) ' $VIRTUAL_ENV_PROMPT
|
||||
|
||||
string join -- \n $prompt # handle multi-line prompts
|
||||
echo "exit $old_status" | .
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
@@ -0,0 +1,89 @@
|
||||
# virtualenv activation module:
|
||||
# - Activate with `overlay use activate.nu`
|
||||
# - Deactivate with `deactivate`, as usual
|
||||
#
|
||||
# To customize the overlay name, you can call `overlay use activate.nu as foo`, but then simply `deactivate` won't work
|
||||
# because it is just an alias to hide the "activate" overlay. You'd need to call `overlay hide foo` manually.
|
||||
|
||||
module warning {
|
||||
export-env {
|
||||
const file = path self
|
||||
error make -u {
|
||||
msg: $"`($file | path basename)` is meant to be used with `overlay use`, not `source`"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
use warning
|
||||
|
||||
export-env {
|
||||
|
||||
let nu_ver = (version | get version | split row '.' | take 2 | each { into int })
|
||||
if $nu_ver.0 == 0 and $nu_ver.1 < 106 {
|
||||
error make {
|
||||
msg: 'virtualenv Nushell activation requires Nushell 0.106 or greater.'
|
||||
}
|
||||
}
|
||||
|
||||
def is-string [x] {
|
||||
($x | describe) == 'string'
|
||||
}
|
||||
|
||||
def has-env [...names] {
|
||||
$names | each {|n| $n in $env } | all {|i| $i }
|
||||
}
|
||||
|
||||
def is-env-true [name: string] {
|
||||
if (has-env $name) {
|
||||
let val = ($env | get --optional $name)
|
||||
if ($val | describe) == 'bool' {
|
||||
$val
|
||||
} else {
|
||||
not ($val | is-empty)
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
let virtual_env = r#'/home/zlata/PycharmProjects/Funktional/.venv'#
|
||||
let bin = r#'bin'#
|
||||
let path_name = if (has-env 'Path') { 'Path' } else { 'PATH' }
|
||||
let venv_path = ([$virtual_env $bin] | path join)
|
||||
let new_path = ($env | get $path_name | prepend $venv_path)
|
||||
let virtual_env_prompt = if (r#''# | is-empty) {
|
||||
($virtual_env | path basename)
|
||||
} else {
|
||||
r#''#
|
||||
}
|
||||
let old_pkg_config_path = if (has-env 'PKG_CONFIG_PATH') { $env.PKG_CONFIG_PATH } else { '' }
|
||||
let new_pkg_config_path = $'($virtual_env)/lib/pkgconfig:($old_pkg_config_path)'
|
||||
let new_env = { $path_name: $new_path VIRTUAL_ENV: $virtual_env VIRTUAL_ENV_PROMPT: $virtual_env_prompt PKG_CONFIG_PATH: $new_pkg_config_path }
|
||||
if (has-env 'TCL_LIBRARY') {
|
||||
let $new_env = $new_env | insert TCL_LIBRARY r#''#
|
||||
}
|
||||
if (has-env 'TK_LIBRARY') {
|
||||
let $new_env = $new_env | insert TK_LIBRARY r#''#
|
||||
}
|
||||
let old_prompt_command = if (has-env 'PROMPT_COMMAND') { $env.PROMPT_COMMAND } else { '' }
|
||||
let new_env = if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') {
|
||||
$new_env
|
||||
} else {
|
||||
let virtual_prefix = $'(char lparen)($virtual_env_prompt)(char rparen) '
|
||||
let new_prompt = if (has-env 'PROMPT_COMMAND') {
|
||||
if ('closure' in ($old_prompt_command | describe)) {
|
||||
{|| $'($virtual_prefix)(do $old_prompt_command)' }
|
||||
} else {
|
||||
{|| $'($virtual_prefix)($old_prompt_command)' }
|
||||
}
|
||||
} else {
|
||||
{|| $'($virtual_prefix)' }
|
||||
}
|
||||
$new_env | merge { PROMPT_COMMAND: $new_prompt VIRTUAL_PREFIX: $virtual_prefix }
|
||||
}
|
||||
load-env $new_env
|
||||
}
|
||||
|
||||
export alias pydoc = python -m pydoc
|
||||
export alias deactivate = overlay hide activate
|
||||
@@ -0,0 +1,213 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
activate.ps1
|
||||
Activates the Python virtual environment that contains the activate.ps1 script.
|
||||
|
||||
.Example
|
||||
activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
Write-Verbose "File exists, parse ``key = value`` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
function global:deactivate([switch] $NonDestructive) {
|
||||
if (Test-Path variable:_OLD_VIRTUAL_PATH) {
|
||||
$env:PATH = $variable:_OLD_VIRTUAL_PATH
|
||||
Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
|
||||
}
|
||||
|
||||
if (Test-Path variable:_OLD_VIRTUAL_TCL_LIBRARY) {
|
||||
$env:TCL_LIBRARY = $variable:_OLD_VIRTUAL_TCL_LIBRARY
|
||||
Remove-Variable "_OLD_VIRTUAL_TCL_LIBRARY" -Scope global
|
||||
} else {
|
||||
if (Test-Path env:TCL_LIBRARY) {
|
||||
Remove-Item env:TCL_LIBRARY -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path variable:_OLD_VIRTUAL_TK_LIBRARY) {
|
||||
$env:TK_LIBRARY = $variable:_OLD_VIRTUAL_TK_LIBRARY
|
||||
Remove-Variable "_OLD_VIRTUAL_TK_LIBRARY" -Scope global
|
||||
} else {
|
||||
if (Test-Path env:TK_LIBRARY) {
|
||||
Remove-Item env:TK_LIBRARY -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path variable:_OLD_PKG_CONFIG_PATH) {
|
||||
$env:PKG_CONFIG_PATH = $variable:_OLD_PKG_CONFIG_PATH
|
||||
Remove-Variable "_OLD_PKG_CONFIG_PATH" -Scope global
|
||||
}
|
||||
|
||||
if (Test-Path function:_old_virtual_prompt) {
|
||||
$function:prompt = $function:_old_virtual_prompt
|
||||
Remove-Item function:\_old_virtual_prompt
|
||||
}
|
||||
|
||||
if ($env:VIRTUAL_ENV) {
|
||||
Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
if ($env:VIRTUAL_ENV_PROMPT) {
|
||||
Remove-Item env:VIRTUAL_ENV_PROMPT -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
if (!$NonDestructive) {
|
||||
Remove-Item function:deactivate
|
||||
Remove-Item function:pydoc
|
||||
}
|
||||
}
|
||||
|
||||
function global:pydoc {
|
||||
& python -m pydoc $args
|
||||
}
|
||||
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
} else {
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
} else {
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose "Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt']
|
||||
} elseif ('' -ne "") {
|
||||
$Prompt = ''
|
||||
} else {
|
||||
$Prompt = Split-Path -Path $VenvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
deactivate -nondestructive
|
||||
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
||||
|
||||
if ('' -ne "") {
|
||||
if (Test-Path env:TCL_LIBRARY) {
|
||||
New-Variable -Scope global -Name _OLD_VIRTUAL_TCL_LIBRARY -Value $env:TCL_LIBRARY
|
||||
}
|
||||
$env:TCL_LIBRARY = ''
|
||||
}
|
||||
|
||||
if ('' -ne "") {
|
||||
if (Test-Path env:TK_LIBRARY) {
|
||||
New-Variable -Scope global -Name _OLD_VIRTUAL_TK_LIBRARY -Value $env:TK_LIBRARY
|
||||
}
|
||||
$env:TK_LIBRARY = ''
|
||||
}
|
||||
|
||||
New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
|
||||
|
||||
if (Test-Path env:PKG_CONFIG_PATH) {
|
||||
New-Variable -Scope global -Name _OLD_PKG_CONFIG_PATH -Value $env:PKG_CONFIG_PATH
|
||||
}
|
||||
$env:PKG_CONFIG_PATH = "$env:VIRTUAL_ENV\lib\pkgconfig;$env:PKG_CONFIG_PATH"
|
||||
|
||||
$env:PATH = "$env:VIRTUAL_ENV/" + 'bin' + ':' + $env:PATH
|
||||
|
||||
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
function global:_old_virtual_prompt {
|
||||
""
|
||||
}
|
||||
$function:_old_virtual_prompt = $function:prompt
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($($_PYTHON_VENV_PROMPT_PREFIX)) "
|
||||
_old_virtual_prompt
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
"""Activate virtualenv for current interpreter:
|
||||
|
||||
import runpy runpy.run_path(this_file)
|
||||
|
||||
This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
|
||||
|
||||
""" # noqa: D415
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import site
|
||||
import sys
|
||||
|
||||
try:
|
||||
abs_file = os.path.abspath(__file__)
|
||||
except NameError as exc:
|
||||
msg = "You must use import runpy; runpy.run_path(this_file)"
|
||||
raise AssertionError(msg) from exc
|
||||
|
||||
bin_dir = os.path.dirname(abs_file)
|
||||
base = bin_dir[: -len('bin') - 1] # ty: ignore[unresolved-reference]
|
||||
|
||||
# prepend bin to PATH (this file is inside the bin directory)
|
||||
os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
|
||||
os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
|
||||
os.environ["VIRTUAL_ENV_PROMPT"] = '' or os.path.basename(base) # ty: ignore[unresolved-reference]
|
||||
|
||||
# Set PKG_CONFIG_PATH to include the virtualenv's pkgconfig directory
|
||||
pkg_config_path = os.path.join(base, "lib", "pkgconfig")
|
||||
existing_pkg_config_path = os.environ.get("PKG_CONFIG_PATH", "")
|
||||
if existing_pkg_config_path:
|
||||
os.environ["PKG_CONFIG_PATH"] = os.pathsep.join([pkg_config_path, existing_pkg_config_path])
|
||||
else:
|
||||
os.environ["PKG_CONFIG_PATH"] = pkg_config_path
|
||||
|
||||
# add the virtual environments libraries to the host python import mechanism
|
||||
prev_length = len(sys.path)
|
||||
for lib in '../lib/python3.14/site-packages'.split(os.pathsep): # ty: ignore[unresolved-reference]
|
||||
path = os.path.realpath(os.path.join(bin_dir, lib))
|
||||
site.addsitedir(path.decode("utf-8") if '' else path) # ty: ignore[unresolved-reference,unresolved-attribute]
|
||||
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
|
||||
|
||||
sys.real_prefix = sys.prefix # ty: ignore[unresolved-attribute]
|
||||
sys.prefix = base
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from coverage.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(main())
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from coverage.cmdline import main_deprecated
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(main_deprecated())
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from coverage.cmdline import main_deprecated
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(main_deprecated())
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
if __name__ == '__main__':
|
||||
from pip._internal.cli.main import main
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
if __name__ == '__main__':
|
||||
from pip._internal.cli.main import main
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
if __name__ == '__main__':
|
||||
from pip._internal.cli.main import main
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
if __name__ == '__main__':
|
||||
from pip._internal.cli.main import main
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from _pytest.config import _console_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(_console_main())
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from pygments.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(main())
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/home/zlata/PycharmProjects/Funktional/.venv/bin/python
|
||||
import sys
|
||||
from _pytest.config import _console_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = sys.argv[0].removesuffix('.exe')
|
||||
sys.exit(_console_main())
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/usr/bin/python3
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
python
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
python
|
||||
Executable
BIN
Binary file not shown.
Reference in new issue
Block a user