summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-02-07 12:46:55 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2018-02-07 12:46:55 -0500
commit041aa143db6964575625f1849de639541efb83a5 (patch)
tree41455da57bf928e326c194d9d69fa1ad20a1ddba
parent6fcbc26f883a37126b2d9486a4703877c2b4d869 (diff)
parente905f8cf8388c7b5b800fa0be4f151d85fb608c1 (diff)
downloadspack-041aa143db6964575625f1849de639541efb83a5.tar.gz
spack-041aa143db6964575625f1849de639541efb83a5.tar.bz2
spack-041aa143db6964575625f1849de639541efb83a5.tar.xz
spack-041aa143db6964575625f1849de639541efb83a5.zip
Merge branch 'releases/v0.11.2'
-rw-r--r--lib/spack/spack/compilers/clang.py4
-rw-r--r--lib/spack/spack/compilers/gcc.py43
-rw-r--r--lib/spack/spack/compilers/intel.py2
-rw-r--r--lib/spack/spack/compilers/nag.py2
-rw-r--r--lib/spack/spack/modules/common.py2
5 files changed, 45 insertions, 8 deletions
diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py
index 6acb2f785c..a748bd95bd 100644
--- a/lib/spack/spack/compilers/clang.py
+++ b/lib/spack/spack/compilers/clang.py
@@ -126,14 +126,14 @@ class Clang(Compiler):
@classmethod
def default_version(cls, comp):
- """The '--version' option works for clang compilers.
+ """The ``--version`` option works for clang compilers.
On most platforms, output looks like this::
clang version 3.1 (trunk 149096)
Target: x86_64-unknown-linux-gnu
Thread model: posix
- On Mac OS X, it looks like this::
+ On macOS, it looks like this::
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py
index dacc95e8d4..b97d8b2e24 100644
--- a/lib/spack/spack/compilers/gcc.py
+++ b/lib/spack/spack/compilers/gcc.py
@@ -91,6 +91,21 @@ class Gcc(Compiler):
@classmethod
def default_version(cls, cc):
+ """Older versions of gcc use the ``-dumpversion`` option.
+ Output looks like this::
+
+ 4.4.7
+
+ In GCC 7, this option was changed to only return the major
+ version of the compiler::
+
+ 7
+
+ A new ``-dumpfullversion`` option was added that gives us
+ what we want::
+
+ 7.2.0
+ """
# Skip any gcc versions that are actually clang, like Apple's gcc.
# Returning "unknown" makes them not detected by default.
# Users can add these manually to compilers.yaml at their own risk.
@@ -104,10 +119,32 @@ class Gcc(Compiler):
@classmethod
def fc_version(cls, fc):
- return get_compiler_version(
+ """Older versions of gfortran use the ``-dumpversion`` option.
+ Output looks like this::
+
+ GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ or::
+
+ 4.8.5
+
+ In GCC 7, this option was changed to only return the major
+ version of the compiler::
+
+ 7
+
+ A new ``-dumpfullversion`` option was added that gives us
+ what we want::
+
+ 7.2.0
+ """
+ version = get_compiler_version(
fc, '-dumpversion',
- # older gfortran versions don't have simple dumpversion output.
- r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)')
+ r'(?:GNU Fortran \(GCC\) )?([\d.]+)')
+ if version in ['7']:
+ version = get_compiler_version(fc, '-dumpfullversion')
+ return version
@classmethod
def f77_version(cls, f77):
diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py
index 1601cf03d4..b66436ecc0 100644
--- a/lib/spack/spack/compilers/intel.py
+++ b/lib/spack/spack/compilers/intel.py
@@ -82,7 +82,7 @@ class Intel(Compiler):
@classmethod
def default_version(cls, comp):
- """The '--version' option seems to be the most consistent one
+ """The ``--version`` option seems to be the most consistent one
for intel compilers. Output looks like this::
icpc (ICC) 12.1.5 20120612
diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py
index d84e4d6f85..20688b67ef 100644
--- a/lib/spack/spack/compilers/nag.py
+++ b/lib/spack/spack/compilers/nag.py
@@ -73,7 +73,7 @@ class Nag(Compiler):
@classmethod
def default_version(self, comp):
- """The '-V' option works for nag compilers.
+ """The ``-V`` option works for nag compilers.
Output looks like this::
NAG Fortran Compiler Release 6.0(Hibiya) Build 1037
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py
index 6feed2938c..86abaae7c3 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -505,7 +505,7 @@ class BaseContext(tengine.Context):
try:
configure_args = getattr(pkg, attr)()
return ' '.join(configure_args)
- except (AttributeError, IOError, KeyError):
+ except (AttributeError, IOError, KeyError, NameError):
# The method doesn't exist in the current spec,
# or it's not usable
pass