Skip to content

Commit

Permalink
Merge pull request #36 from xylar/add_tmpdir
Browse files Browse the repository at this point in the history
Add arg for specifying spack temp. directory
  • Loading branch information
xylar authored Mar 22, 2022
2 parents d7ce808 + 73a7b2c commit a45a7cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mache/spack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,
machine=None, include_e3sm_hdf5_netcdf=False,
yaml_template=None):
yaml_template=None, tmpdir=None):
"""
Clone the ``spack_for_mache_{{version}}`` branch from
`E3SM's spack clone <https://github.com/E3SM-Project/spack>`_ and build
Expand Down Expand Up @@ -46,6 +46,9 @@ def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,
A jinja template for a yaml file to be used for the environment instead
of the mache template. This allows you to use compilers and other
modules that differ from E3SM.
tmpdir : str, optional
A temporary directory for building spack packages
"""

if machine is None:
Expand Down Expand Up @@ -94,6 +97,10 @@ def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,

template = Template(
resources.read_text('mache.spack', 'build_spack_env.template'))
if tmpdir is not None:
modules = f'{modules}\n' \
f'export TMPDIR={tmpdir}'

build_file = template.render(modules=modules, version=__version__,
spack_path=spack_path, env_name=env_name,
yaml_filename=yaml_filename)
Expand Down

0 comments on commit a45a7cc

Please sign in to comment.