From 31b472feacdde56b4e2be36776720189abc4b075 Mon Sep 17 00:00:00 2001 From: Toby Davis Date: Thu, 15 Aug 2024 12:06:24 +0200 Subject: [PATCH] Allow exact env-variable specification --- src/module.rs | 2 ++ src/modulefile.rs | 1 + src/sccmod/env.py | 1 + 3 files changed, 4 insertions(+) diff --git a/src/module.rs b/src/module.rs index 6637a07..3bf559b 100644 --- a/src/module.rs +++ b/src/module.rs @@ -27,6 +27,7 @@ pub enum Dependency { #[derive(Debug, Clone)] pub enum Environment { Set(String), + SetExact(String), Append(String), Prepend(String), } @@ -346,6 +347,7 @@ impl Module { .into_iter() .map(|(name, (op, value))| match op.as_ref() { "set" => Ok((name, Environment::Set(value))), + "setexact" => Ok((name, Environment::SetExact(value))), "append" => Ok((name, Environment::Append(value))), "prepend" => Ok((name, Environment::Prepend(value))), other => Err(format!( diff --git a/src/modulefile.rs b/src/modulefile.rs index bcba294..a8903d5 100644 --- a/src/modulefile.rs +++ b/src/modulefile.rs @@ -67,6 +67,7 @@ pub fn generate(module: &Module) -> String { environment_variables.push_str(&match value { // Environment::Set(val) => format!("setenv \"{key}\" \"{val}\"\n"), Environment::Set(val) => format!("::flavours::modify-path setenv \"{key}\" \"{val}\"\n"), + Environment::SetExact(val) => format!(" setenv \"{key}\" \"{val}\"\n"), Environment::Append(val) => format!("::flavours::append-path \"{key}\" \"{val}\"\n"), Environment::Prepend(val) => { format!("::flavours::modify-path prepend-path \"{key}\" \"{val}\"\n") diff --git a/src/sccmod/env.py b/src/sccmod/env.py index b086f87..11638fb 100644 --- a/src/sccmod/env.py +++ b/src/sccmod/env.py @@ -1,3 +1,4 @@ SET = "set" +SET_EXACT = "setexact" APPEND = "append" PREPEND = "prepend"