@@ -168,7 +168,8 @@ def ensure_channels_configured(self):
168168 def ensure_conda_build_installed_if_needed (self ):
169169 if self .use_local and not self .conda_build_available :
170170 conda_targets = [CondaTarget ("conda-build" , version = CONDA_BUILD_VERSION )]
171- return install_conda_targets (conda_targets , env_name = None , conda_context = self )
171+ # Cannot use --use-local during installation fo conda-build.
172+ return install_conda_targets (conda_targets , env_name = None , conda_context = self , allow_local = False )
172173 else :
173174 return 0
174175
@@ -263,11 +264,11 @@ def exec_command(self, operation, args):
263264 log .warning (e )
264265 return e .returncode
265266
266- def exec_create (self , args ):
267+ def exec_create (self , args , allow_local = True ):
267268 create_base_args = [
268269 "-y"
269270 ]
270- if self ._use_local :
271+ if allow_local and self ._use_local :
271272 create_base_args .extend (["--use-local" ])
272273 create_base_args .extend (args )
273274 return self .exec_command ("create" , create_base_args )
@@ -281,11 +282,11 @@ def exec_remove(self, args):
281282 remove_base_args .extend (args )
282283 return self .exec_command ("env" , remove_base_args )
283284
284- def exec_install (self , args ):
285+ def exec_install (self , args , allow_local = True ):
285286 install_base_args = [
286287 "-y"
287288 ]
288- if self ._use_local :
289+ if allow_local and self ._use_local :
289290 install_base_args .extend (["--use-local" ])
290291 install_base_args .extend (args )
291292 return self .exec_command ("install" , install_base_args )
@@ -448,7 +449,7 @@ def install_conda(conda_context=None, force_conda_build=False):
448449 os .remove (script_path )
449450
450451
451- def install_conda_targets (conda_targets , env_name = None , conda_context = None ):
452+ def install_conda_targets (conda_targets , env_name = None , conda_context = None , allow_local = True ):
452453 conda_context = _ensure_conda_context (conda_context )
453454 conda_context .ensure_channels_configured ()
454455 if env_name is not None :
@@ -457,9 +458,9 @@ def install_conda_targets(conda_targets, env_name=None, conda_context=None):
457458 ]
458459 for conda_target in conda_targets :
459460 create_args .append (conda_target .package_specifier )
460- return conda_context .exec_create (create_args )
461+ return conda_context .exec_create (create_args , allow_local = allow_local )
461462 else :
462- return conda_context .exec_install ([t .package_specifier for t in conda_targets ])
463+ return conda_context .exec_install ([t .package_specifier for t in conda_targets ], allow_local = allow_local )
463464
464465
465466def install_conda_target (conda_target , conda_context = None , skip_environment = False ):
0 commit comments