update externals format to match existing code
This commit is contained in:
@@ -474,9 +474,14 @@ assuming the paths to the compiler executables are determinable from
|
||||
the prefix.
|
||||
|
||||
If the paths to the compiler executable are not determinable from the
|
||||
prefix, you can add them to the ``extra_attributes`` field. Similarly,
|
||||
all other fields from the compilers config can be added to the
|
||||
``extra_attributes`` field for an external representing a compiler.
|
||||
prefix, you can add them to the ``extra_attributes`` field using the
|
||||
``compilers`` key. The ``compilers`` key accepts compilers for ``c``,
|
||||
``cxx``, ``fortran``, and ``f77``.
|
||||
|
||||
For all other fields from the ``compilers`` config, they can be added
|
||||
to the ``extra_attributes`` field for an external representing a
|
||||
compiler. These fields are used as-is in the internal representation
|
||||
of the compiler config.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@@ -493,11 +498,10 @@ all other fields from the compilers config can be added to the
|
||||
- spec: llvm+clang@15.0.0 arch=linux-rhel8-skylake
|
||||
prefix: /usr
|
||||
extra_attributes:
|
||||
paths:
|
||||
cc: /usr/bin/clang-with-suffix
|
||||
compilers:
|
||||
c: /usr/bin/clang-with-suffix
|
||||
cxx: /usr/bin/clang++-with-extra-info
|
||||
fc: /usr/bin/gfortran
|
||||
f77: /usr/bin/gfortran
|
||||
fortran: /usr/bin/gfortran
|
||||
extra_rpaths:
|
||||
- /usr/lib/llvm/
|
||||
|
||||
|
||||
@@ -167,7 +167,17 @@ def _compiler_config_from_external(config):
|
||||
prefix = config.get("prefix", None)
|
||||
|
||||
compiler_class = class_for_compiler_name(compiler_spec.name)
|
||||
paths = extra_attributes.get("paths", {})
|
||||
paths = extra_attributes.get("compilers", {})
|
||||
|
||||
# compilers format has cc/fc/f77, externals format has "c/fortran"
|
||||
if "c" in paths:
|
||||
paths["cc"] = paths.pop("c")
|
||||
if "fortran" in paths:
|
||||
fc = paths.pop("fortran")
|
||||
paths["fc"] = fc
|
||||
if "f77" not in paths:
|
||||
paths["f77"] = fc
|
||||
|
||||
compiler_langs = ["cc", "cxx", "fc", "f77"]
|
||||
for lang in compiler_langs:
|
||||
if paths.setdefault(lang, None):
|
||||
|
||||
@@ -259,11 +259,10 @@ def test_compiler_list_empty(no_compilers_yaml, working_env, compilers_dir):
|
||||
"prefix": "/path/to/fake",
|
||||
"modules": ["gcc/7.7.7", "foobar"],
|
||||
"extra_attributes": {
|
||||
"paths": {
|
||||
"cc": "/path/to/fake/gcc",
|
||||
"compilers": {
|
||||
"c": "/path/to/fake/gcc",
|
||||
"cxx": "/path/to/fake/g++",
|
||||
"fc": "/path/to/fake/gfortran",
|
||||
"f77": "/path/to/fake/gfortran",
|
||||
"fortran": "/path/to/fake/gfortran",
|
||||
},
|
||||
"flags": {"fflags": "-ffree-form"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user