1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00

resolve several issues in nu_conda and nu_msvs (#872)

1. fix: update `(sys).host` to `sys host` to work for 0.94.x
2. fix: handle incorrect behaviors when re-importing nu_conda or nu_msvs
3. doc: update minimum requirements of nushell in README.md
This commit is contained in:
neur1n 2024-06-07 20:36:00 +08:00 committed by GitHub
parent de2829091f
commit d95857c119
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 66 additions and 66 deletions

View file

@ -3,7 +3,7 @@ A simple module for activating and deactivating Conda environments.
## Prerequisites ## Prerequisites
- [nushell](https://github.com/nushell/nushell) >= 0.83.0 - [nushell](https://github.com/nushell/nushell) >= 0.94.0
## Installation ## Installation

View file

@ -1,5 +1,6 @@
export-env { export-env {
$env.CONDA_BASE_PATH = (if ((sys).host.name == "Windows") {$env.Path} else {$env.PATH}) if not ("CONDA_CURR" in $env) {
$env.CONDA_BASE_PATH = (if ((sys host).name == "Windows") {$env.Path} else {$env.PATH})
let info = ( let info = (
if not (which mamba | is-empty) { if not (which mamba | is-empty) {
@ -20,11 +21,12 @@ export-env {
}}) }})
$env.CONDA_CURR = null $env.CONDA_CURR = null
}
} }
export def --env activate [name: string] { export def --env activate [name: string] {
if ($env.CONDA_ROOT | is-empty) { if ($env.CONDA_ROOT | is-empty) {
print "Neither Conda nor Mamba is valid." print "Neither Conda nor Mamba is available."
return return
} }
@ -35,7 +37,7 @@ export def --env activate [name: string] {
} }
let new_path = ( let new_path = (
if ((sys).host.name == "Windows") { if ((sys host).name == "Windows") {
update-path-windows ($env.CONDA_ENVS | get $name) update-path-windows ($env.CONDA_ENVS | get $name)
} else { } else {
update-path-linux ($env.CONDA_ENVS | get $name) update-path-linux ($env.CONDA_ENVS | get $name)
@ -46,7 +48,7 @@ export def --env activate [name: string] {
export def --env deactivate [] { export def --env deactivate [] {
if ($env.CONDA_ROOT | is-empty) { if ($env.CONDA_ROOT | is-empty) {
print "Neither Conda nor Mamba is valid." print "Neither Conda nor Mamba is available."
return return
} }

View file

@ -3,7 +3,7 @@ A module for Using Microsoft Visual Studio (MSVS) command line tools from Nushel
## Prerequisites ## Prerequisites
- [nushell](https://github.com/nushell/nushell) >= 0.91.0 - [nushell](https://github.com/nushell/nushell) >= 0.94.0
- [vswhere](https://github.com/microsoft/vswhere) standalone or comes with VS - [vswhere](https://github.com/microsoft/vswhere) standalone or comes with VS

View file

@ -1,4 +1,5 @@
export-env { export-env {
if not ("MSVS_ACTIVATED" in $env) {
$env.MSVS_BASE_PATH = $env.Path $env.MSVS_BASE_PATH = $env.Path
let info = ( let info = (
@ -33,6 +34,9 @@ export-env {
$"($env.MSVS_MSDK_ROOT)Include/($env.MSVS_MSDK_VER)/um", $"($env.MSVS_MSDK_ROOT)Include/($env.MSVS_MSDK_VER)/um",
$"($env.MSVS_MSDK_ROOT)Include/($env.MSVS_MSDK_VER)/winrt" $"($env.MSVS_MSDK_ROOT)Include/($env.MSVS_MSDK_VER)/winrt"
] | str join ";") ] | str join ";")
$env.MSVS_ACTIVATED = false
}
} }
export def --env activate [ export def --env activate [
@ -41,7 +45,7 @@ export def --env activate [
--sdk (-s): string = "latest" # Version of Windows SDK, must be "latest" or a valid version string --sdk (-s): string = "latest" # Version of Windows SDK, must be "latest" or a valid version string
] { ] {
if (($env.MSVS_ROOT | is-empty) or ($env.MSVS_MSVC_ROOT | is-empty)) { if (($env.MSVS_ROOT | is-empty) or ($env.MSVS_MSVC_ROOT | is-empty)) {
print "Either Microsoft Visual Studio or MSVC is valid." print "Neither Microsoft Visual Studio nor MSVC is available."
return return
} }
@ -125,17 +129,12 @@ export def --env activate [
LIB: $lib_path LIB: $lib_path
} }
hide-env MSVS_BASE_PATH $env.MSVS_ACTIVATED = true
hide-env MSVS_ROOT
hide-env MSVS_MSVC_ROOT
hide-env MSVS_MSDK_ROOT
hide-env MSVS_MSDK_VER
hide-env MSVS_INCLUDE_PATH
} }
export def --env deactivate [] { export def --env deactivate [] {
if (($env.MSVS_ROOT | is-empty) or ($env.MSVS_MSVC_ROOT | is-empty)) { if (($env.MSVS_ROOT? | is-empty) or ($env.MSVS_MSVC_ROOT? | is-empty)) {
print "Either Microsoft Visual Studio or MSVC is valid." print "Neither Microsoft Visual Studio nor MSVC is available."
return return
} }
@ -144,6 +143,5 @@ export def --env deactivate [] {
PATH: $env.MSVS_BASE_PATH PATH: $env.MSVS_BASE_PATH
} }
hide-env INCLUDE $env.MSVS_ACTIVATED = false
hide-env LIB
} }