diff options
author | Michael Kuhn <michael@ikkoku.de> | 2019-03-09 04:06:22 +0100 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2019-03-08 21:06:22 -0600 |
commit | a1c91f3c07b88d11ebd3ec13cac7ded631d93c8e (patch) | |
tree | 6d52f337a6e4be37a71add69c574a309ae643b8b /lib | |
parent | 43b45f4140ed0c160667fef91a318cb2cdcce8ca (diff) | |
download | spack-a1c91f3c07b88d11ebd3ec13cac7ded631d93c8e.tar.gz spack-a1c91f3c07b88d11ebd3ec13cac7ded631d93c8e.tar.bz2 spack-a1c91f3c07b88d11ebd3ec13cac7ded631d93c8e.tar.xz spack-a1c91f3c07b88d11ebd3ec13cac7ded631d93c8e.zip |
Fix find_headers to also look for C++ headers and Fortran modules (#10798)
Currently, only C headers are considered, causing build failures for
packages depending on, e.g., netcdf-fortran and xerces-c. Additionally,
the regex used to look for the include path component did not consider
word boundaries, causing false matches.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 01e9f540f0..00e4dc5f37 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -957,7 +957,9 @@ class HeaderList(FileList): commonly used compiler flags or names. """ - include_regex = re.compile(r'(.*)(include)(.*)') + # Make sure to only match complete words, otherwise path components such + # as "xinclude" will cause false matches. + include_regex = re.compile(r'(.*)(\binclude\b)(.*)') def __init__(self, files): super(HeaderList, self).__init__(files) @@ -1122,10 +1124,11 @@ def find_headers(headers, root, recursive=False): raise TypeError(message) # Construct the right suffix for the headers - suffix = 'h' + suffixes = ['h', 'hpp', 'mod'] # List of headers we are searching with suffixes - headers = ['{0}.{1}'.format(header, suffix) for header in headers] + headers = ['{0}.{1}'.format(header, suffix) for header in headers + for suffix in suffixes] return HeaderList(find(root, headers, recursive)) |