From 1288b04fba8ab1dfb991ccf2ae12084a438e1455 Mon Sep 17 00:00:00 2001
From: jmcarcell <jmcarcell@users.noreply.github.com>
Date: Sat, 9 Sep 2023 17:12:32 +0200
Subject: [PATCH] Move an unset to common.py

---
 packages/key4hep-stack/common.py  | 8 +++++++-
 packages/key4hep-stack/package.py | 3 ---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/packages/key4hep-stack/common.py b/packages/key4hep-stack/common.py
index 11a53e9f..3130bd97 100644
--- a/packages/key4hep-stack/common.py
+++ b/packages/key4hep-stack/common.py
@@ -31,7 +31,13 @@
 from shlex import quote as cmd_quote
 
 # List of env variables that will NOT be set
-IGNORE_VARS = set(["BOOST_ROOT", "SPACK_LOADED_HASHES"])
+IGNORE_VARS = set([
+    # Fix CMP0144 warnings: https://github.com/key4hep/key4hep-spack/issues/525
+    "BOOST_ROOT",
+    "SPACK_LOADED_HASHES",
+    # this fixes loading the local emacs: https://github.com/key4hep/key4hep-spack/issues/486
+    "XDG_DATA_DIRS",
+])
 
 def k4_setup_env_for_framework_tests(spec, env):
     """Setup for tests that need the run environment."""
diff --git a/packages/key4hep-stack/package.py b/packages/key4hep-stack/package.py
index c926ad6f..36e1e3a1 100644
--- a/packages/key4hep-stack/package.py
+++ b/packages/key4hep-stack/package.py
@@ -143,9 +143,6 @@ def setup_run_environment(self, env):
         env.set("LC_ALL", "C")
         env.set("KEY4HEP_STACK", os.path.join(self.spec.prefix, "setup.sh"))
 
-        # this fixes loading the local emacs, see https://github.com/key4hep/key4hep-spack/issues/486
-        env.unset("XDG_DATA_DIRS")
-
         # set vdt, needed for root, see https://github.com/spack/spack/pull/37278
         env.prepend_path("CPATH", self.spec["vdt"].prefix.include)