Skip to content

Commit

Permalink
Header subdirectories for Python and Eigen (#10773)
Browse files Browse the repository at this point in the history
Fixes #10769 

This updates the .headers property to include header subdirectories
for Python and Eigen (as is recommended by these packages).

#10623 updated the default behavior of .headers.directories to
exclude subdirectories (since this can cause clashes with system
headers). This broke some packages which depended on the old behavior
of .headers.directories: for example if you had
<package-prefix>/include/subdir/ex1.h, .headers.directories would
include <package-prefix>/include/subdir.
  • Loading branch information
scheibelp committed Mar 4, 2019
1 parent 0ce1500 commit af4a36c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions var/spack/repos/builtin/packages/eigen/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ class Eigen(CMakePackage):
depends_on('gmp', when='+mpfr')

patch('find-ptscotch.patch', when='@3.3.4')

@property
def headers(self):
headers = find_all_headers(self.prefix.include)
headers.directories = [self.prefix.include.eigen3]
return headers
8 changes: 5 additions & 3 deletions var/spack/repos/builtin/packages/python/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,15 @@ def libs(self):
def headers(self):
config_h = self.get_config_h_filename()

if os.path.exists(config_h):
return HeaderList(config_h)
else:
if not os.path.exists(config_h):
includepy = self.get_config_var('INCLUDEPY')
msg = 'Unable to locate {0} headers in {1}'
raise RuntimeError(msg.format(self.name, includepy))

headers = HeaderList(config_h)
headers.directories = [os.path.dirname(config_h)]
return headers

@property
def python_lib_dir(self):
return join_path('lib', 'python{0}'.format(self.version.up_to(2)))
Expand Down

0 comments on commit af4a36c

Please sign in to comment.