filter_compiler_path: added the possibility to narrow search path
Following a comment from Todd, the search path for the files listed in `filter_compiler_wrappers` can now be narrowed. Anyhow, the function implementation still makes use of `find`, the rationale being that we have already seen packages that install artifacts in e.g. architecture dependent folders. The possibility to have a relative search path might be a good compromise between the previous approach and the one suggested in the review. Also: 'ignore_absent' and 'backup' keyword arguments can be optionally forwarded to `filter_file`.
This commit is contained in:
parent
4e48bae096
commit
c62b3eef55
6 changed files with 45 additions and 15 deletions
|
@ -143,24 +143,47 @@ def filter_compiler_wrappers(*files, **kwargs):
|
||||||
whatever compiler they were built with.
|
whatever compiler they were built with.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
*files: files to be filtered
|
*files: files to be filtered relative to the search root (which is,
|
||||||
**kwargs: at present supports the keyword 'after' to specify after
|
by default, the installation prefix)
|
||||||
which phase the files should be filtered (defaults to 'install').
|
|
||||||
|
**kwargs: allowed keyword arguments
|
||||||
|
|
||||||
|
after
|
||||||
|
specifies after which phase the files should be
|
||||||
|
filtered (defaults to 'install')
|
||||||
|
|
||||||
|
relative_root
|
||||||
|
path relative to prefix where to start searching for
|
||||||
|
the files to be filtered. If not set the install prefix
|
||||||
|
wil be used as the search root. **It is highly recommended
|
||||||
|
to set this, as searching from the installation prefix may
|
||||||
|
affect performance severely in some cases**.
|
||||||
|
|
||||||
|
ignore_absent, backup
|
||||||
|
these two keyword arguments, if present, will be forwarded
|
||||||
|
to ``filter_file`` (see its documentation for more information
|
||||||
|
on their behavior)
|
||||||
"""
|
"""
|
||||||
after = kwargs.get('after', 'install')
|
after = kwargs.get('after', 'install')
|
||||||
|
relative_root = kwargs.get('relative_root', None)
|
||||||
def _filter_compiler_wrappers_impl(self):
|
|
||||||
# Compute the absolute path of the files to be filtered and
|
|
||||||
# remove links from the list.
|
|
||||||
abs_files = llnl.util.filesystem.find(self.prefix, files)
|
|
||||||
abs_files = [x for x in abs_files if not os.path.islink(x)]
|
|
||||||
|
|
||||||
filter_kwargs = {
|
filter_kwargs = {
|
||||||
'ignore_absent': True,
|
'ignore_absent': kwargs.get('ignore_absent', True),
|
||||||
'backup': False,
|
'backup': kwargs.get('backup', False),
|
||||||
'string': True
|
'string': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _filter_compiler_wrappers_impl(self):
|
||||||
|
# Compute the absolute path of the search root
|
||||||
|
root = os.path.join(
|
||||||
|
self.prefix, relative_root
|
||||||
|
) if relative_root else self.prefix
|
||||||
|
|
||||||
|
# Compute the absolute path of the files to be filtered and
|
||||||
|
# remove links from the list.
|
||||||
|
abs_files = llnl.util.filesystem.find(root, files)
|
||||||
|
abs_files = [x for x in abs_files if not os.path.islink(x)]
|
||||||
|
|
||||||
x = llnl.util.filesystem.FileFilter(*abs_files)
|
x = llnl.util.filesystem.FileFilter(*abs_files)
|
||||||
|
|
||||||
x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs)
|
x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs)
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Hdf5(AutotoolsPackage):
|
||||||
patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch',
|
patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch',
|
||||||
when='@1.10.1%intel@18')
|
when='@1.10.1%intel@18')
|
||||||
|
|
||||||
filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc')
|
filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', relative_root='bin')
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
|
||||||
|
|
|
@ -71,7 +71,9 @@ class Mpich(AutotoolsPackage):
|
||||||
provides('mpi@:3.0', when='@3:')
|
provides('mpi@:3.0', when='@3:')
|
||||||
provides('mpi@:1.3', when='@1:')
|
provides('mpi@:1.3', when='@1:')
|
||||||
|
|
||||||
filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90')
|
filter_compiler_wrappers(
|
||||||
|
'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin'
|
||||||
|
)
|
||||||
|
|
||||||
# fix MPI_Barrier segmentation fault
|
# fix MPI_Barrier segmentation fault
|
||||||
# see https://lists.mpich.org/pipermail/discuss/2016-May/004764.html
|
# see https://lists.mpich.org/pipermail/discuss/2016-May/004764.html
|
||||||
|
|
|
@ -107,7 +107,9 @@ class Mvapich2(AutotoolsPackage):
|
||||||
depends_on('libpciaccess', when=(sys.platform != 'darwin'))
|
depends_on('libpciaccess', when=(sys.platform != 'darwin'))
|
||||||
depends_on('cuda', when='+cuda')
|
depends_on('cuda', when='+cuda')
|
||||||
|
|
||||||
filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort')
|
filter_compiler_wrappers(
|
||||||
|
'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin'
|
||||||
|
)
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
base_url = "http://mvapich.cse.ohio-state.edu/download"
|
base_url = "http://mvapich.cse.ohio-state.edu/download"
|
||||||
|
|
|
@ -228,7 +228,8 @@ class Openmpi(AutotoolsPackage):
|
||||||
'mpif90-vt-wrapper-data.txt',
|
'mpif90-vt-wrapper-data.txt',
|
||||||
'mpif90-wrapper-data.txt',
|
'mpif90-wrapper-data.txt',
|
||||||
'mpif77-vt-wrapper-data.txt',
|
'mpif77-vt-wrapper-data.txt',
|
||||||
'mpif77-wrapper-data.txt'
|
'mpif77-wrapper-data.txt',
|
||||||
|
relative_root=os.path.join('share', 'openmpi')
|
||||||
)
|
)
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
|
|
|
@ -88,7 +88,9 @@ class R(AutotoolsPackage):
|
||||||
|
|
||||||
patch('zlib.patch', when='@:3.3.2')
|
patch('zlib.patch', when='@:3.3.2')
|
||||||
|
|
||||||
filter_compiler_wrappers('Makeconf')
|
filter_compiler_wrappers(
|
||||||
|
'Makeconf', relative_root=os.path.join('rlib', 'R', 'etc')
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def etcdir(self):
|
def etcdir(self):
|
||||||
|
|
Loading…
Reference in a new issue