Skip to content

Commit

Permalink
add patch from PR ESMCI/cime#4683
Browse files Browse the repository at this point in the history
  • Loading branch information
lexming committed Sep 20, 2024
1 parent 3d36fe0 commit ab8a873
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions patches/4683-esmci-cime-fix_pythonpath_prepend.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 777cd60420b2d2a674e7dc186dd4f661c4f9f3f9 Mon Sep 17 00:00:00 2001
From: Alex Domingo <alex.domingo.toro@vub.be>
Date: Fri, 20 Sep 2024 13:32:26 +0200
Subject: [PATCH] avoid breaking Python environment by prepending CIME paths to
PYTHONPATH

---
CIME/utils.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/CIME/utils.py b/CIME/utils.py
index 85fa30017b0..e84d614b12b 100644
--- a/CIME/utils.py
+++ b/CIME/utils.py
@@ -820,12 +820,10 @@ def run_cmd(
# or build a relative path and append `sys.path` to import
# `standard_script_setup`. Providing `PYTHONPATH` fixes protential
# broken paths in external python.
- env.update(
- {
- "CIMEROOT": f"{get_cime_root()}",
- "PYTHONPATH": f"{get_cime_root()}:{get_tools_path()}",
- }
- )
+ env_pythonpath = os.environ.get("PYTHONPATH", "").split(":")
+ cime_pythonpath = [f"{get_cime_root()}", f"{get_tools_path()}"] + env_pythonpath
+ env["PYTHONPATH"] = ":".join(filter(None, cime_pythonpath))
+ env["CIMEROOT"] = f"{get_cime_root()}"

if timeout:
with Timeout(timeout):

0 comments on commit ab8a873

Please sign in to comment.