Header subdirectories for Python and Eigen (#10773)

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.
This commit is contained in:
Peter Scheibel 2019-03-04 12:36:51 -06:00 committed by GitHub
parent 0ce1500376
commit af4a36c4d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -46,3 +46,9 @@ class Eigen(CMakePackage):
depends_on('gmp', when='+mpfr') depends_on('gmp', when='+mpfr')
patch('find-ptscotch.patch', when='@3.3.4') 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

View File

@ -619,13 +619,15 @@ def libs(self):
def headers(self): def headers(self):
config_h = self.get_config_h_filename() config_h = self.get_config_h_filename()
if os.path.exists(config_h): if not os.path.exists(config_h):
return HeaderList(config_h)
else:
includepy = self.get_config_var('INCLUDEPY') includepy = self.get_config_var('INCLUDEPY')
msg = 'Unable to locate {0} headers in {1}' msg = 'Unable to locate {0} headers in {1}'
raise RuntimeError(msg.format(self.name, includepy)) raise RuntimeError(msg.format(self.name, includepy))
headers = HeaderList(config_h)
headers.directories = [os.path.dirname(config_h)]
return headers
@property @property
def python_lib_dir(self): def python_lib_dir(self):
return join_path('lib', 'python{0}'.format(self.version.up_to(2))) return join_path('lib', 'python{0}'.format(self.version.up_to(2)))