-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port
before v0.60/virtual_environments
(#849)
This PR is part of porting all old scripts #221 and includes the `virtual_environments` module ## 5 files changed - `conda.nu`: removed, already in `modules/virtual_enviromnents/conda/nu_conda.nu` - `conda_deactivate.nu`: also removed, has already been merged with `nu_conda.nu` - `README.nu`: removed, similar info in `modules/virtual_enviromnents/README.md` - `venv.nu`: ported to `modules/virtual_enviromnents/venv/venv.nu` - `venv_deactivate.nu`: ported to `modules/virtual_enviromnents/venv/venv_deactivate.nu`
- Loading branch information
Showing
6 changed files
with
25 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export def --env activate [venv_dir] { | ||
let venv_abs_dir = ($venv_dir | path expand) | ||
let venv_name = ($venv_abs_dir | path basename) | ||
let old_path = $env.PATH | ||
let new_path = (venv-path $venv_abs_dir) | ||
let new_env = ({VENV_OLD_PATH: $old_path, VIRTUAL_ENV: $venv_name} | merge $new_path) | ||
load-env $new_env | ||
} | ||
|
||
def "venv-path" [venv_dir] { | ||
let env_path = [ | ||
$venv_dir, | ||
([$venv_dir, "bin"] | path join) | ||
] | ||
return { | ||
PATH: ($env.PATH | prepend $env_path) | ||
} | ||
} | ||
|
||
export def --env deactivate [] { | ||
$env.PATH = $env.VENV_OLD_PATH | ||
hide-env VIRTUAL_ENV | ||
hide-env VENV_OLD_PATH | ||
|
||
} |