Improved naming of properties and classes (per Denis comments).
This commit is contained in:
		@@ -214,8 +214,8 @@
 | 
				
			|||||||
    'IntelPackage',
 | 
					    'IntelPackage',
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from spack.mixins import FilterCompilerWrappersPackageMixin
 | 
					import spack.mixins as mixins
 | 
				
			||||||
__all__ += ['FilterCompilerWrappersPackageMixin']
 | 
					__all__ += ['mixins']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from spack.version import Version, ver
 | 
					from spack.version import Version, ver
 | 
				
			||||||
__all__ += ['Version', 'ver']
 | 
					__all__ += ['Version', 'ver']
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,14 +27,14 @@
 | 
				
			|||||||
import llnl.util.filesystem
 | 
					import llnl.util.filesystem
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FilterCompilerWrappersPackageMixin(object):
 | 
					class FilterCompilerWrappers(object):
 | 
				
			||||||
    """This mixin class registers a callback that filters a list of files
 | 
					    """This mixin class registers a callback that filters a list of files
 | 
				
			||||||
    after installation and substitutes hardcoded paths pointing to the Spack
 | 
					    after installation and substitutes hardcoded paths pointing to the Spack
 | 
				
			||||||
    compiler wrappers with the corresponding 'real' compilers.
 | 
					    compiler wrappers with the corresponding 'real' compilers.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #: compiler wrappers to be filtered (needs to be overridden)
 | 
					    #: 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')
 | 
					    #: phase after which the callback is invoked (default 'install')
 | 
				
			||||||
    filter_phase = 'install'
 | 
					    filter_phase = 'install'
 | 
				
			||||||
@@ -43,7 +43,7 @@ def __init__(self):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        attr_name = '_InstallPhase_{0}'.format(self.filter_phase)
 | 
					        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
 | 
					        # the instance), so that we can modify it and add the mixin method
 | 
				
			||||||
        phase = getattr(type(self), attr_name)
 | 
					        phase = getattr(type(self), attr_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,10 +54,10 @@ def __init__(self):
 | 
				
			|||||||
        phase = getattr(type(self), attr_name)
 | 
					        phase = getattr(type(self), attr_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        phase.run_after.append(
 | 
					        phase.run_after.append(
 | 
				
			||||||
            FilterCompilerWrappersPackageMixin.filter_compilers
 | 
					            FilterCompilerWrappers.filter_compilers
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        super(FilterCompilerWrappersPackageMixin, self).__init__()
 | 
					        super(FilterCompilerWrappers, self).__init__()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def filter_compilers(self):
 | 
					    def filter_compilers(self):
 | 
				
			||||||
        """Substitutes any path referring to a Spack compiler wrapper
 | 
					        """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}
 | 
					        kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.compiler_wrappers:
 | 
					        if self.to_be_filtered_for_wrappers:
 | 
				
			||||||
            x = llnl.util.filesystem.FileFilter(*self.compiler_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['CC'], self.compiler.cc, **kwargs)
 | 
				
			||||||
            x.filter(os.environ['CXX'], self.compiler.cxx, **kwargs)
 | 
					            x.filter(os.environ['CXX'], self.compiler.cxx, **kwargs)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@
 | 
				
			|||||||
from spack import *
 | 
					from spack import *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Hdf5(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
 | 
					class Hdf5(AutotoolsPackage, mixins.FilterCompilerWrappers):
 | 
				
			||||||
    """HDF5 is a data model, library, and file format for storing and managing
 | 
					    """HDF5 is a data model, library, and file format for storing and managing
 | 
				
			||||||
    data. It supports an unlimited variety of datatypes, and is designed for
 | 
					    data. It supports an unlimited variety of datatypes, and is designed for
 | 
				
			||||||
    flexible and efficient I/O and for high volume and complex data.
 | 
					    flexible and efficient I/O and for high volume and complex data.
 | 
				
			||||||
@@ -297,7 +297,7 @@ def check_install(self):
 | 
				
			|||||||
        shutil.rmtree(checkdir)
 | 
					        shutil.rmtree(checkdir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def compiler_wrappers(self):
 | 
					    def to_be_filtered_for_wrappers(self):
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            join_path(self.prefix.bin, 'h5c++'),
 | 
					            join_path(self.prefix.bin, 'h5c++'),
 | 
				
			||||||
            join_path(self.prefix.bin, 'h5cc'),
 | 
					            join_path(self.prefix.bin, 'h5cc'),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Mpich(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
 | 
					class Mpich(AutotoolsPackage, mixins.FilterCompilerWrappers):
 | 
				
			||||||
    """MPICH is a high performance and widely portable implementation of
 | 
					    """MPICH is a high performance and widely portable implementation of
 | 
				
			||||||
    the Message Passing Interface (MPI) standard."""
 | 
					    the Message Passing Interface (MPI) standard."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,7 +171,7 @@ def configure_args(self):
 | 
				
			|||||||
        return config_args
 | 
					        return config_args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def compiler_wrappers(self):
 | 
					    def to_be_filtered_for_wrappers(self):
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            join_path(self.prefix.bin, 'mpicc'),
 | 
					            join_path(self.prefix.bin, 'mpicc'),
 | 
				
			||||||
            join_path(self.prefix.bin, 'mpicxx'),
 | 
					            join_path(self.prefix.bin, 'mpicxx'),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ def _process_manager_validator(values):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Mvapich2(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
 | 
					class Mvapich2(AutotoolsPackage, mixins.FilterCompilerWrappers):
 | 
				
			||||||
    """MVAPICH2 is an MPI implementation for Infiniband networks."""
 | 
					    """MVAPICH2 is an MPI implementation for Infiniband networks."""
 | 
				
			||||||
    homepage = "http://mvapich.cse.ohio-state.edu/"
 | 
					    homepage = "http://mvapich.cse.ohio-state.edu/"
 | 
				
			||||||
    url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2.tar.gz"
 | 
					    url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2.tar.gz"
 | 
				
			||||||
@@ -233,7 +233,7 @@ def configure_args(self):
 | 
				
			|||||||
        return args
 | 
					        return args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def compiler_wrappers(self):
 | 
					    def to_be_filtered_for_wrappers(self):
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            join_path(self.prefix.bin, 'mpicc'),
 | 
					            join_path(self.prefix.bin, 'mpicc'),
 | 
				
			||||||
            join_path(self.prefix.bin, 'mpicxx'),
 | 
					            join_path(self.prefix.bin, 'mpicxx'),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ def _mxm_dir():
 | 
				
			|||||||
        return None
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Openmpi(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
 | 
					class Openmpi(AutotoolsPackage, mixins.FilterCompilerWrappers):
 | 
				
			||||||
    """The Open MPI Project is an open source Message Passing Interface
 | 
					    """The Open MPI Project is an open source Message Passing Interface
 | 
				
			||||||
       implementation that is developed and maintained by a consortium
 | 
					       implementation that is developed and maintained by a consortium
 | 
				
			||||||
       of academic, research, and industry partners. Open MPI is
 | 
					       of academic, research, and industry partners. Open MPI is
 | 
				
			||||||
@@ -376,7 +376,7 @@ def configure_args(self):
 | 
				
			|||||||
        return config_args
 | 
					        return config_args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def compiler_wrappers(self):
 | 
					    def to_be_filtered_for_wrappers(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        basepath = join_path(self.prefix, 'share', 'openmpi')
 | 
					        basepath = join_path(self.prefix, 'share', 'openmpi')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@
 | 
				
			|||||||
from spack import *
 | 
					from spack import *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class R(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
 | 
					class R(AutotoolsPackage, mixins.FilterCompilerWrappers):
 | 
				
			||||||
    """R is 'GNU S', a freely available language and environment for
 | 
					    """R is 'GNU S', a freely available language and environment for
 | 
				
			||||||
    statistical computing and graphics which provides a wide variety of
 | 
					    statistical computing and graphics which provides a wide variety of
 | 
				
			||||||
    statistical and graphical techniques: linear and nonlinear modelling,
 | 
					    statistical and graphical techniques: linear and nonlinear modelling,
 | 
				
			||||||
@@ -130,7 +130,7 @@ def copy_makeconf(self):
 | 
				
			|||||||
        shutil.copy(src_makeconf, dst_makeconf)
 | 
					        shutil.copy(src_makeconf, dst_makeconf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def compiler_wrappers(self):
 | 
					    def to_be_filtered_for_wrappers(self):
 | 
				
			||||||
        return [join_path(self.etcdir, 'Makeconf')]
 | 
					        return [join_path(self.etcdir, 'Makeconf')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # ========================================================================
 | 
					    # ========================================================================
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user