mixins: moved debug logs to 'filter_file'. Renamed shadowed variable name.
Following comments from Todd: - the call to tty.debug has been moved deeper, to log the filtering of each file - the shadowing on the name "kwargs" is avoided
This commit is contained in:
parent
a01a68218c
commit
4e48bae096
2 changed files with 16 additions and 11 deletions
|
@ -119,9 +119,15 @@ def groupid_to_group(x):
|
||||||
regex = re.escape(regex)
|
regex = re.escape(regex)
|
||||||
|
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
|
|
||||||
|
msg = 'FILTER FILE: {0} [replacing "{1}"]'
|
||||||
|
tty.debug(msg.format(filename, regex))
|
||||||
|
|
||||||
backup_filename = filename + "~"
|
backup_filename = filename + "~"
|
||||||
|
|
||||||
if ignore_absent and not os.path.exists(filename):
|
if ignore_absent and not os.path.exists(filename):
|
||||||
|
msg = 'FILTER FILE: file "{0}" not found. Skipping to next file.'
|
||||||
|
tty.debug(msg.format(filename))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Create backup file. Don't overwrite an existing backup
|
# Create backup file. Don't overwrite an existing backup
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import llnl.util.filesystem
|
import llnl.util.filesystem
|
||||||
import llnl.util.tty as tty
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'filter_compiler_wrappers'
|
'filter_compiler_wrappers'
|
||||||
|
@ -152,25 +150,26 @@ def filter_compiler_wrappers(*files, **kwargs):
|
||||||
after = kwargs.get('after', 'install')
|
after = kwargs.get('after', 'install')
|
||||||
|
|
||||||
def _filter_compiler_wrappers_impl(self):
|
def _filter_compiler_wrappers_impl(self):
|
||||||
|
|
||||||
tty.debug('Filtering compiler wrappers: {0}'.format(files))
|
|
||||||
|
|
||||||
# Compute the absolute path of the files to be filtered and
|
# Compute the absolute path of the files to be filtered and
|
||||||
# remove links from the list.
|
# remove links from the list.
|
||||||
abs_files = llnl.util.filesystem.find(self.prefix, files)
|
abs_files = llnl.util.filesystem.find(self.prefix, files)
|
||||||
abs_files = [x for x in abs_files if not os.path.islink(x)]
|
abs_files = [x for x in abs_files if not os.path.islink(x)]
|
||||||
|
|
||||||
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
|
filter_kwargs = {
|
||||||
|
'ignore_absent': True,
|
||||||
|
'backup': False,
|
||||||
|
'string': True
|
||||||
|
}
|
||||||
|
|
||||||
x = llnl.util.filesystem.FileFilter(*abs_files)
|
x = llnl.util.filesystem.FileFilter(*abs_files)
|
||||||
|
|
||||||
x.filter(os.environ['CC'], self.compiler.cc, **kwargs)
|
x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs)
|
||||||
x.filter(os.environ['CXX'], self.compiler.cxx, **kwargs)
|
x.filter(os.environ['CXX'], self.compiler.cxx, **filter_kwargs)
|
||||||
x.filter(os.environ['F77'], self.compiler.f77, **kwargs)
|
x.filter(os.environ['F77'], self.compiler.f77, **filter_kwargs)
|
||||||
x.filter(os.environ['FC'], self.compiler.fc, **kwargs)
|
x.filter(os.environ['FC'], self.compiler.fc, **filter_kwargs)
|
||||||
|
|
||||||
# Remove this linking flag if present (it turns RPATH into RUNPATH)
|
# Remove this linking flag if present (it turns RPATH into RUNPATH)
|
||||||
x.filter('-Wl,--enable-new-dtags', '', **kwargs)
|
x.filter('-Wl,--enable-new-dtags', '', **filter_kwargs)
|
||||||
|
|
||||||
PackageMixinsMeta.register_method_after(
|
PackageMixinsMeta.register_method_after(
|
||||||
_filter_compiler_wrappers_impl, after
|
_filter_compiler_wrappers_impl, after
|
||||||
|
|
Loading…
Reference in a new issue