Skip to content

Commit d75dab3

Browse files
authored
Merge pull request #25 from vub-hpc/soft-pythonpath
add patch from PR ESMCI/cime#4683
2 parents 6c5942a + ab8a873 commit d75dab3

10 files changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 777cd60420b2d2a674e7dc186dd4f661c4f9f3f9 Mon Sep 17 00:00:00 2001
2+
From: Alex Domingo <[email protected]>
3+
Date: Fri, 20 Sep 2024 13:32:26 +0200
4+
Subject: [PATCH] avoid breaking Python environment by prepending CIME paths to
5+
PYTHONPATH
6+
7+
---
8+
CIME/utils.py | 10 ++++------
9+
1 file changed, 4 insertions(+), 6 deletions(-)
10+
11+
diff --git a/CIME/utils.py b/CIME/utils.py
12+
index 85fa30017b0..e84d614b12b 100644
13+
--- a/CIME/utils.py
14+
+++ b/CIME/utils.py
15+
@@ -820,12 +820,10 @@ def run_cmd(
16+
# or build a relative path and append `sys.path` to import
17+
# `standard_script_setup`. Providing `PYTHONPATH` fixes protential
18+
# broken paths in external python.
19+
- env.update(
20+
- {
21+
- "CIMEROOT": f"{get_cime_root()}",
22+
- "PYTHONPATH": f"{get_cime_root()}:{get_tools_path()}",
23+
- }
24+
- )
25+
+ env_pythonpath = os.environ.get("PYTHONPATH", "").split(":")
26+
+ cime_pythonpath = [f"{get_cime_root()}", f"{get_tools_path()}"] + env_pythonpath
27+
+ env["PYTHONPATH"] = ":".join(filter(None, cime_pythonpath))
28+
+ env["CIMEROOT"] = f"{get_cime_root()}"
29+
30+
if timeout:
31+
with Timeout(timeout):

0 commit comments

Comments
 (0)