Skip to content

Commit

Permalink
let-env is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanelteren committed Jul 29, 2023
1 parent 74e908c commit 7337d2d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ option(BUILD_MICROMAMBA "Build micromamba" OFF)
option(BUILD_MAMBA_PACKAGE "Build mamba package utility" OFF)
option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" OFF)


include("cmake/CompilerWarnings.cmake")

if (MSVC)
Expand All @@ -34,6 +35,8 @@ if (MSVC)
# add_definitions("-DUNICODE -D_UNICODE")
endif()



# Variants
# ========

Expand Down
26 changes: 12 additions & 14 deletions libmamba/data/mamba.nu
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@

export def micromamba [arg] {
let cmd = arg[0]
let argv = arg[1]
export def micromamba [...arg] {
let cmd = $arg.0
let argv = if ( $arg.1? == null ) { "" } else { $arg.1 }

if ($cmd in [ activate deactivate ]){
$env.MAMBA_EXE $cmd $argv
if ($cmd in [ activate deactivate ]) {
exec $env.MAMBA_EXE $cmd $argv
}

elif ($cmd in [update upgrade remove uninstall]){
$env.MAMBA_EXE $cmd $argv
$env.MAMBA_EXE reactivate
elif ($cmd in [update upgrade remove uninstall]) {
exec $env.MAMBA_EXE $cmd $argv
exec $env.MAMBA_EXE reactivate
}

else {
$env.MAMBA_EXE $cmd $arg
}
}
}

if ($env.MAMBA_SHLVL? == null){
let-env MAMBA_SHLVL = 0
let-env PATH = ($env.PATH | append $env.MAMBA_ROOT_PREFIX/condabin)
if ( $env.MAMBA_SHLVL? == null ) {
$env.MAMBA_SHLVL = 0
$env.PATH = ( $env.PATH | append ([ $env.MAMBA_ROOT_PREFIX condabin] | path join ))
}
4 changes: 2 additions & 2 deletions libmamba/src/core/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ namespace mamba

if (!env_transform.export_path.empty())
{
out << "let-env PATH = $(env.PATH | append " << env_transform.export_path << ")\"\n";
out << "$env.PATH = $(env.PATH | append " << env_transform.export_path << ")\"\n";
}

for (const fs::u8path& ds : env_transform.deactivate_scripts)
Expand All @@ -1306,7 +1306,7 @@ namespace mamba

for (const auto& [ekey, evar] : env_transform.export_vars)
{
out << "let-env " << ekey << " = " << evar << "\"\n";
out << "$env." << ekey << " = " << evar << "\"\n";
}

for (const fs::u8path& p : env_transform.activate_scripts)
Expand Down
6 changes: 3 additions & 3 deletions libmamba/src/core/shell_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ namespace mamba

content << "\n# >>> mamba initialize >>>\n";
content << "# !! Contents within this block are managed by 'mamba init' !!\n";
content << "let-env MAMBA_EXE = " << mamba_exe << "\n";
content << "let-env MAMBA_ROOT_PREFIX = " << env_prefix << "\n";
content << "$env.MAMBA_EXE = " << mamba_exe << "\n";
content << "$env.MAMBA_ROOT_PREFIX = " << env_prefix << "\n";
content << "exec $env.MAMBA_EXE shell hook --shell nu --root-prefix $env.MAMBA_ROOT_PREFIX\n";
content << "let-env PATH = ($env.PATH | append ($env.MAMBA_ROOT_PREFIX)/bin) \n";
content << "$env.PATH = ($env.PATH | append ( [$env.MAMBA_ROOT_PREFIX bin] | path join)) \n";
content << "# <<< mamba initialize <<<\n";
return content.str();
}
Expand Down
6 changes: 4 additions & 2 deletions mamba/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
__version__ = version_ns["__version__"]

data_files = [
("etc/profile.d", ["mamba/shell_templates/mamba.sh",
"mamba/shell_templates/mamba.nu"]),
(
"etc/profile.d",
["mamba/shell_templates/mamba.sh", "mamba/shell_templates/mamba.nu"],
),
("etc/fish/conf.d", ["mamba/shell_templates/mamba.fish"]),
]
if sys.platform == "win32":
Expand Down

0 comments on commit 7337d2d

Please sign in to comment.