예제 #1
0
def compiler_find(args):
    """Search either $PATH or a list of paths OR MODULES for compilers and
       add them to Spack's configuration.

    """
    # None signals spack.compiler.find_compilers to use its default logic
    paths = args.add_paths or None

    # Below scope=None because we want new compilers that don't appear
    # in any other configuration.
    new_compilers = spack.compilers.find_new_compilers(paths, scope=None)
    if new_compilers:
        spack.compilers.add_compilers_to_config(new_compilers,
                                                scope=args.scope,
                                                init_config=False)
        n = len(new_compilers)
        s = 's' if n > 1 else ''

        config = spack.config.config
        filename = config.get_config_filename(args.scope, 'compilers')
        tty.msg("Added %d new compiler%s to %s" % (n, s, filename))
        colify(reversed(sorted(c.spec for c in new_compilers)), indent=4)
    else:
        tty.msg("Found no new compilers")
    tty.msg("Compilers are defined in the following files:")
    colify(spack.compilers.compiler_config_files(), indent=4)
예제 #2
0
def compiler_config_files():
    config_files = list()
    config = spack.config.config
    for scope in config.file_scopes:
        name = scope.name
        compiler_config = config.get('compilers', scope=name)
        if compiler_config:
            config_files.append(config.get_config_filename(name, 'compilers'))
    return config_files
예제 #3
0
파일: __init__.py 프로젝트: LLNL/spack
def compiler_config_files():
    config_files = list()
    config = spack.config.config
    for scope in config.file_scopes:
        name = scope.name
        compiler_config = config.get('compilers', scope=name)
        if compiler_config:
            config_files.append(config.get_config_filename(name, 'compilers'))
    return config_files
예제 #4
0
파일: spack_yaml.py 프로젝트: eic/spack
def test_config_blame(config):
    """check blame info for elements in mock configuration."""
    config_file = config.get_config_filename('site', 'config')

    check_blame('install_tree', config_file, 2)
    check_blame('source_cache', config_file, 11)
    check_blame('misc_cache', config_file, 12)
    check_blame('verify_ssl', config_file, 13)
    check_blame('checksum', config_file, 14)
    check_blame('dirty', config_file, 15)
예제 #5
0
파일: spack_yaml.py 프로젝트: LLNL/spack
def test_config_blame(config):
    """check blame info for elements in mock configuration."""
    config_file = config.get_config_filename('site', 'config')

    check_blame('install_tree', config_file, 2)
    check_blame('source_cache', config_file, 11)
    check_blame('misc_cache', config_file, 12)
    check_blame('verify_ssl', config_file, 13)
    check_blame('checksum', config_file, 14)
    check_blame('dirty', config_file, 15)
예제 #6
0
파일: spack_yaml.py 프로젝트: eic/spack
def test_config_blame_with_override(config):
    """check blame for an element from an override scope"""
    config_file = config.get_config_filename('site', 'config')

    with spack.config.override('config:install_tree', {'root': 'foobar'}):
        check_blame('install_tree', 'overrides')

        check_blame('source_cache', config_file, 11)
        check_blame('misc_cache', config_file, 12)
        check_blame('verify_ssl', config_file, 13)
        check_blame('checksum', config_file, 14)
        check_blame('dirty', config_file, 15)
예제 #7
0
파일: spack_yaml.py 프로젝트: LLNL/spack
def test_config_blame_with_override(config):
    """check blame for an element from an override scope"""
    config_file = config.get_config_filename('site', 'config')

    with spack.config.override('config:install_tree', 'foobar'):
        check_blame('install_tree', 'overrides')

        check_blame('source_cache', config_file, 11)
        check_blame('misc_cache', config_file, 12)
        check_blame('verify_ssl', config_file, 13)
        check_blame('checksum', config_file, 14)
        check_blame('dirty', config_file, 15)
예제 #8
0
파일: config.py 프로젝트: matz-e/spack
def config_edit(args):
    if not args.scope:
        if args.section == 'compilers':
            args.scope = spack.config.default_modify_scope()
        else:
            args.scope = 'user'
    if not args.section:
        args.section = None

    config = spack.config.config
    config_file = config.get_config_filename(args.scope, args.section)
    editor(config_file)
예제 #9
0
파일: config.py 프로젝트: matzke1/spack
def config_edit(args):
    if not args.scope:
        if args.section == 'compilers':
            args.scope = spack.config.default_modify_scope()
        else:
            args.scope = 'user'
    if not args.section:
        args.section = None

    config = spack.config.config
    config_file = config.get_config_filename(args.scope, args.section)
    editor(config_file)
예제 #10
0
파일: __init__.py 프로젝트: lguyot/spack
def get_compiler_duplicates(compiler_spec, arch_spec):
    config = spack.config.config

    scope_to_compilers = {}
    for scope in config.scopes:
        compilers = compilers_for_spec(compiler_spec, arch_spec=arch_spec,
                                       scope=scope, use_cache=False)
        if compilers:
            scope_to_compilers[scope] = compilers

    cfg_file_to_duplicates = {}
    for scope, compilers in scope_to_compilers.items():
        config_file = config.get_config_filename(scope, 'compilers')
        cfg_file_to_duplicates[config_file] = compilers

    return cfg_file_to_duplicates
예제 #11
0
파일: __init__.py 프로젝트: LLNL/spack
def get_compiler_duplicates(compiler_spec, arch_spec):
    config = spack.config.config

    scope_to_compilers = {}
    for scope in config.scopes:
        compilers = compilers_for_spec(compiler_spec, arch_spec=arch_spec,
                                       scope=scope, use_cache=False)
        if compilers:
            scope_to_compilers[scope] = compilers

    cfg_file_to_duplicates = {}
    for scope, compilers in scope_to_compilers.items():
        config_file = config.get_config_filename(scope, 'compilers')
        cfg_file_to_duplicates[config_file] = compilers

    return cfg_file_to_duplicates
예제 #12
0
def compiler_find(args):
    """Search either $PATH or a list of paths OR MODULES for compilers and
       add them to Spack's configuration.

    """
    # None signals spack.compiler.find_compilers to use its default logic
    paths = args.add_paths or None

    # Don't initialize compilers config via compilers.get_compiler_config.
    # Just let compiler_find do the
    # entire process and return an empty config from all_compilers
    # Default for any other process is init_config=True
    compilers = [c for c in spack.compilers.find_compilers(paths)]
    new_compilers = []
    for c in compilers:
        arch_spec = ArchSpec((None, c.operating_system, c.target))
        same_specs = spack.compilers.compilers_for_spec(c.spec,
                                                        arch_spec,
                                                        init_config=False)

        if not same_specs:
            new_compilers.append(c)

    if new_compilers:
        spack.compilers.add_compilers_to_config(new_compilers,
                                                scope=args.scope,
                                                init_config=False)
        n = len(new_compilers)
        s = 's' if n > 1 else ''

        config = spack.config.config
        filename = config.get_config_filename(args.scope, 'compilers')
        tty.msg("Added %d new compiler%s to %s" % (n, s, filename))
        colify(reversed(sorted(c.spec for c in new_compilers)), indent=4)
    else:
        tty.msg("Found no new compilers")
    tty.msg("Compilers are defined in the following files:")
    colify(spack.compilers.compiler_config_files(), indent=4)
예제 #13
0
def test_internal_config_filename(config, write_config_file):
    write_config_file('config', config_low, 'low')
    config.push_scope(spack.config.InternalConfigScope('command_line'))

    with pytest.raises(NotImplementedError):
        config.get_config_filename('command_line', 'config')
예제 #14
0
파일: config.py 프로젝트: matzke1/spack
def test_internal_config_filename(config, write_config_file):
    write_config_file('config', config_low, 'low')
    config.push_scope(spack.config.InternalConfigScope('command_line'))

    with pytest.raises(NotImplementedError):
        config.get_config_filename('command_line', 'config')