Skip to content

Commit ce4b635

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 ce4b635

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
include mache/cime_machine_config/*.xml
22
include mache/machines/*.cfg
3+
include mache/machines/pre_conda/*.sh
4+
include mache/machines/pre_conda/*.csh
35
include mache/spack/templates/*.yaml
46
include mache/spack/templates/*.template
57
include mache/spack/templates/*.sh
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)