@@ -172,8 +172,7 @@ def __init__(self, args):
172172 # load the optional mirrors.yaml from system config, and add any additional
173173 # mirrors specified on the command line.
174174 self ._logger .debug ("Configuring mirrors." )
175- self .mirrors = mirror .Mirrors (self .system_config_path , args .cache )
176- self .cache = self .mirrors .build_cache_mirror
175+ self .mirrors = mirror .Mirrors (self .system_config_path , pathlib .Path (args .cache ))
177176
178177 # optional post install hook
179178 if self .post_install_hook is not None :
@@ -202,6 +201,13 @@ def spack_repo(self):
202201 return repo_path
203202 return None
204203
204+ # Returns:
205+ # Path: if the recipe specified a build cache mirror
206+ # None: if no build cache mirror is used
207+ @property
208+ def build_cache_mirror (self ):
209+ return self .mirrors .build_cache_mirror
210+
205211 # Returns:
206212 # Path: of the recipe extra path if it exists
207213 # None: if there is no user-provided extra path in the recipe
@@ -511,7 +517,7 @@ def compiler_files(self):
511517 )
512518
513519 makefile_template = env .get_template ("Makefile.compilers" )
514- push_to_cache = self .cache
520+ push_to_cache = self .build_cache_mirror is not None
515521 files ["makefile" ] = makefile_template .render (
516522 compilers = self .compilers ,
517523 push_to_cache = push_to_cache ,
@@ -542,7 +548,7 @@ def environment_files(self):
542548 jenv .filters ["py2yaml" ] = schema .py2yaml
543549
544550 makefile_template = jenv .get_template ("Makefile.environments" )
545- push_to_cache = self .cache is not None
551+ push_to_cache = self .build_cache_mirror is not None
546552 files ["makefile" ] = makefile_template .render (
547553 environments = self .environments ,
548554 push_to_cache = push_to_cache ,
0 commit comments