Skip to content

Commit 212c68b

Browse files
committed
Add option for pre_conda shell script
This is needed for E3SM-Unified activation scripts on ALCF Polaris because its `xalt` module interferes with even the most basic `conda` operations such as `conda activate`.
1 parent 955a71e commit 212c68b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from importlib.resources import read_text
2+
3+
4+
def load_pre_conda_script(machine, ext):
5+
"""
6+
Return the contents of a shell script to prepend before loading conda
7+
8+
Parameters
9+
----------
10+
machine : str
11+
The name of the machine to load the script for.
12+
ext : str
13+
The file extension of the script, either 'sh' or 'csh'.
14+
15+
Returns
16+
-------
17+
str
18+
The contents of the shell script.
19+
"""
20+
try:
21+
return read_text('mache.machines.pre_conda', f'{machine}.{ext}')
22+
except FileNotFoundError:
23+
return ''
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module unload xalt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module unload xalt

0 commit comments

Comments
 (0)