Improved naming of properties and classes (per Denis comments).

This commit is contained in:
alalazo
2017-06-11 08:35:22 +02:00
committed by Todd Gamblin
parent 28e129b087
commit 8e0f9038ab
7 changed files with 21 additions and 19 deletions

View File

@@ -214,8 +214,8 @@
'IntelPackage',
]
from spack.mixins import FilterCompilerWrappersPackageMixin
__all__ += ['FilterCompilerWrappersPackageMixin']
import spack.mixins as mixins
__all__ += ['mixins']
from spack.version import Version, ver
__all__ += ['Version', 'ver']

View File

@@ -27,14 +27,14 @@
import llnl.util.filesystem
class FilterCompilerWrappersPackageMixin(object):
class FilterCompilerWrappers(object):
"""This mixin class registers a callback that filters a list of files
after installation and substitutes hardcoded paths pointing to the Spack
compiler wrappers with the corresponding 'real' compilers.
"""
#: compiler wrappers to be filtered (needs to be overridden)
compiler_wrappers = []
to_be_filtered_for_wrappers = []
#: phase after which the callback is invoked (default 'install')
filter_phase = 'install'
@@ -43,7 +43,7 @@ def __init__(self):
attr_name = '_InstallPhase_{0}'.format(self.filter_phase)
# Here we want to get the attribute directly from the class (noe from
# Here we want to get the attribute directly from the class (not from
# the instance), so that we can modify it and add the mixin method
phase = getattr(type(self), attr_name)
@@ -54,10 +54,10 @@ def __init__(self):
phase = getattr(type(self), attr_name)
phase.run_after.append(
FilterCompilerWrappersPackageMixin.filter_compilers
FilterCompilerWrappers.filter_compilers
)
super(FilterCompilerWrappersPackageMixin, self).__init__()
super(FilterCompilerWrappers, self).__init__()
def filter_compilers(self):
"""Substitutes any path referring to a Spack compiler wrapper
@@ -70,8 +70,10 @@ def filter_compilers(self):
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
if self.compiler_wrappers:
x = llnl.util.filesystem.FileFilter(*self.compiler_wrappers)
if self.to_be_filtered_for_wrappers:
x = llnl.util.filesystem.FileFilter(
*self.to_be_filtered_for_wrappers
)
x.filter(os.environ['CC'], self.compiler.cc, **kwargs)
x.filter(os.environ['CXX'], self.compiler.cxx, **kwargs)