diff --git a/MANIFEST.in b/MANIFEST.in index 588719c8..9a06a146 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,7 @@ include mache/cime_machine_config/*.xml include mache/machines/*.cfg +include mache/machines/pre_conda/*.sh +include mache/machines/pre_conda/*.csh include mache/spack/templates/*.yaml include mache/spack/templates/*.template include mache/spack/templates/*.sh diff --git a/mache/machines/pre_conda/__init__.py b/mache/machines/pre_conda/__init__.py new file mode 100644 index 00000000..9ab69101 --- /dev/null +++ b/mache/machines/pre_conda/__init__.py @@ -0,0 +1,23 @@ +from importlib.resources import read_text + + +def load_pre_conda_script(machine, ext): + """ + Return the contents of a shell script to prepend before loading conda + + Parameters + ---------- + machine : str + The name of the machine to load the script for. + ext : str + The file extension of the script, either 'sh' or 'csh'. + + Returns + ------- + str + The contents of the shell script. + """ + try: + return read_text('mache.machines.pre_conda', f'{machine}.{ext}') + except FileNotFoundError: + return '' diff --git a/mache/machines/pre_conda/polaris.csh b/mache/machines/pre_conda/polaris.csh new file mode 100644 index 00000000..fce7c8c8 --- /dev/null +++ b/mache/machines/pre_conda/polaris.csh @@ -0,0 +1 @@ +module unload xalt diff --git a/mache/machines/pre_conda/polaris.sh b/mache/machines/pre_conda/polaris.sh new file mode 100644 index 00000000..fce7c8c8 --- /dev/null +++ b/mache/machines/pre_conda/polaris.sh @@ -0,0 +1 @@ +module unload xalt