@@ -94,7 +94,8 @@ from mache.spack import get_spack_script
9494```
9595
9696** Purpose:**
97- Generates a shell script snippet to activate a Spack environment and load any required modules or environment variables.
97+ Generates a shell script snippet to activate a Spack environment and load the
98+ required modules or environment variables.
9899
99100** Typical usage in downstream packages:**
100101
@@ -113,20 +114,24 @@ spack_script = get_spack_script(
113114 mpi = mpi,
114115 shell = ' sh' , # or 'csh'
115116 machine = machine,
116- config_file = machine_config,
117117 include_e3sm_lapack = include_e3sm_lapack,
118118 include_e3sm_hdf5_netcdf = e3sm_hdf5_netcdf,
119- yaml_template = yaml_template
120119)
121120```
122121
123- ** Returns:**
124- A string containing shell commands to:
122+ ** How the script is composed:**
123+
124+ The returned snippet is assembled in three steps:
125125
126- - Load required modules (if any).
127- - Source the Spack setup script.
128- - Activate the specified Spack environment.
129- - Set any additional environment variables.
126+ 1 . Optionally source Spack and activate the requested environment.
127+ 2 . Auto-generate module loads and environment exports from the E3SM CIME
128+ machine configuration (` mache/cime_machine_config/config_machines.xml ` ) for
129+ the given ` (machine, compiler, mpi) ` and target shell (` sh ` or ` csh ` ).
130+ 3 . Append any Mache template override present in ` mache/spack/templates/ ` named
131+ ` <machine>.<sh|csh> ` or ` <machine>_<compiler>_<mpi>.<sh|csh> ` .
132+
133+ This design keeps Mache aligned with E3SM’s authoritative machine
134+ configuration and minimizes maintenance.
130135
131136** Usage in activation scripts:**
132137
@@ -144,7 +149,8 @@ from mache.spack import get_modules_env_vars_and_mpi_compilers
144149```
145150
146151** Purpose:**
147- Returns the MPI compiler wrappers and a shell snippet to load modules and set environment variables for a given machine, compiler, and MPI library.
152+ Returns the MPI compiler wrappers and a shell snippet to load modules and set
153+ environment variables for a given machine, compiler, and MPI library.
148154
149155** Typical usage in downstream packages:**
150156
@@ -161,7 +167,6 @@ mpicc, mpicxx, mpifc, mod_env_commands = get_modules_env_vars_and_mpi_compilers(
161167 shell = ' sh' , # or 'csh'
162168 include_e3sm_lapack = include_e3sm_lapack,
163169 include_e3sm_hdf5_netcdf = e3sm_hdf5_netcdf,
164- yaml_template = yaml_template
165170)
166171```
167172
@@ -172,13 +177,18 @@ mpicc, mpicxx, mpifc, mod_env_commands = get_modules_env_vars_and_mpi_compilers(
172177- ` mpifc ` : Name of the MPI Fortran compiler wrapper (e.g., ` mpif90 ` or ` ftn ` ).
173178- ` mod_env_commands ` : Shell commands to load modules and set environment variables.
174179
175- ** Usage in build scripts:**
180+ ** Notes and usage in build scripts:**
176181
177182``` bash
178183{{ mod_env_commands }}
179184# Now safe to use $mpicc, $mpicxx, $mpifc for building MPI-dependent software
180185```
181186
187+ - This helper produces a minimal snippet based on Mache’s template overrides
188+ (when present). It does not auto-generate content from
189+ ` config_machines.xml ` . If you need the full environment setup used by
190+ downstream activation scripts, prefer ` get_spack_script ` .
191+
182192---
183193
184194## Example: How Downstream Packages Use These Functions
0 commit comments