def test_internal_config_update(config, write_config_file): write_config_file('config', config_low, 'low') before = config.get('config') assert before['install_tree'] == 'install_tree_path' # add an internal configuration scope scope = spack.config.InternalConfigScope('command_line') assert 'InternalConfigScope' in repr(scope) config.push_scope(scope) command_config = config.get('config', scope='command_line') command_config['install_tree'] = 'foo/bar' config.set('config', command_config, scope='command_line') after = config.get('config') assert after['install_tree'] == 'foo/bar'
def configure_compilers(compiler_action, scope=None): if compiler_action == 'INSTALL_MISSING': tty.debug('Make sure bootstrapped compiler will be installed') config = cfg.get('config') config['install_missing_compilers'] = True cfg.set('config', config) elif compiler_action == 'FIND_ANY': tty.debug('Just find any available compiler') find_args = ['find'] if scope: find_args.extend(['--scope', scope]) output = spack_compiler(*find_args) tty.debug('spack compiler find') tty.debug(output) output = spack_compiler('list') tty.debug('spack compiler list') tty.debug(output) else: tty.debug('No compiler action to be taken') return None
def remove_pr_mirror(): cfg_scope = cfg.default_modify_scope() mirrors = cfg.get('mirrors', scope=cfg_scope) mirrors.pop('ci_pr_mirror') cfg.set('mirrors', mirrors, scope=cfg_scope)
def add_pr_mirror(url): cfg_scope = cfg.default_modify_scope() mirrors = cfg.get('mirrors', scope=cfg_scope) items = [(n, u) for n, u in mirrors.items()] items.insert(0, ('ci_pr_mirror', url)) cfg.set('mirrors', syaml.syaml_dict(items), scope=cfg_scope)