Spack packages now PEP8 compliant.
This commit is contained in:
@@ -23,7 +23,9 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import glob, string
|
||||
import glob
|
||||
import string
|
||||
|
||||
|
||||
class Mfem(Package):
|
||||
"""Free, lightweight, scalable C++ library for finite element methods."""
|
||||
@@ -31,10 +33,12 @@ class Mfem(Package):
|
||||
homepage = 'http://www.mfem.org'
|
||||
url = 'https://github.com/mfem/mfem'
|
||||
|
||||
version('3.2', '2938c3deed4ec4f7fd5b5f5cfe656845282e86e2dcd477d292390058b7b94340',
|
||||
version('3.2',
|
||||
'2938c3deed4ec4f7fd5b5f5cfe656845282e86e2dcd477d292390058b7b94340',
|
||||
url='http://goo.gl/Y9T75B', expand=False, preferred=True)
|
||||
|
||||
version('3.1', '841ea5cf58de6fae4de0f553b0e01ebaab9cd9c67fa821e8a715666ecf18fc57',
|
||||
version('3.1',
|
||||
'841ea5cf58de6fae4de0f553b0e01ebaab9cd9c67fa821e8a715666ecf18fc57',
|
||||
url='http://goo.gl/xrScXn', expand=False)
|
||||
# version('3.1', git='https://github.com/mfem/mfem.git',
|
||||
# commit='dbae60fe32e071989b52efaaf59d7d0eb2a3b574')
|
||||
@@ -71,8 +75,9 @@ def check_variants(self, spec):
|
||||
if '+suite-sparse' in spec and ('+metis' not in spec or
|
||||
'+lapack' not in spec):
|
||||
raise InstallError('mfem+suite-sparse must be built with ' +
|
||||
'+metis and +lapack!')
|
||||
if 'metis@5:' in spec and '%clang' in spec and ('^cmake %gcc' not in spec):
|
||||
'+metis and +lapack!')
|
||||
if 'metis@5:' in spec and '%clang' in spec and (
|
||||
'^cmake %gcc' not in spec):
|
||||
raise InstallError('To work around CMake bug with clang, must ' +
|
||||
'build mfem with mfem[+variants] %clang ' +
|
||||
'^cmake %gcc to force CMake to build with gcc')
|
||||
@@ -86,15 +91,17 @@ def install(self, spec, prefix):
|
||||
if '+lapack' in spec:
|
||||
lapack_lib = '-L{0} -llapack -L{1} -lblas'.format(
|
||||
spec['lapack'].prefix.lib, spec['blas'].prefix.lib)
|
||||
options.extend(['MFEM_USE_LAPACK=YES',
|
||||
'LAPACK_OPT=-I%s' % spec['lapack'].prefix.include,
|
||||
'LAPACK_LIB=%s' % lapack_lib])
|
||||
options.extend([
|
||||
'MFEM_USE_LAPACK=YES',
|
||||
'LAPACK_OPT=-I%s' % spec['lapack'].prefix.include,
|
||||
'LAPACK_LIB=%s' % lapack_lib])
|
||||
|
||||
if '+hypre' in spec:
|
||||
options.extend(['HYPRE_DIR=%s' % spec['hypre'].prefix,
|
||||
'HYPRE_OPT=-I%s' % spec['hypre'].prefix.include,
|
||||
'HYPRE_LIB=-L%s' % spec['hypre'].prefix.lib +
|
||||
' -lHYPRE'])
|
||||
options.extend([
|
||||
'HYPRE_DIR=%s' % spec['hypre'].prefix,
|
||||
'HYPRE_OPT=-I%s' % spec['hypre'].prefix.include,
|
||||
'HYPRE_LIB=-L%s' % spec['hypre'].prefix.lib +
|
||||
' -lHYPRE'])
|
||||
|
||||
if '+metis' in spec:
|
||||
metis_lib = '-L%s -lmetis' % spec['metis'].prefix.lib
|
||||
@@ -102,22 +109,26 @@ def install(self, spec, prefix):
|
||||
metis_str = 'MFEM_USE_METIS_5=YES'
|
||||
else:
|
||||
metis_str = 'MFEM_USE_METIS_5=NO'
|
||||
options.extend([metis_str,
|
||||
'METIS_DIR=%s' % spec['metis'].prefix,
|
||||
'METIS_OPT=-I%s' % spec['metis'].prefix.include,
|
||||
'METIS_LIB=%s' % metis_lib])
|
||||
options.extend([
|
||||
metis_str,
|
||||
'METIS_DIR=%s' % spec['metis'].prefix,
|
||||
'METIS_OPT=-I%s' % spec['metis'].prefix.include,
|
||||
'METIS_LIB=%s' % metis_lib])
|
||||
|
||||
if '+mpi' in spec: options.extend(['MFEM_USE_MPI=YES'])
|
||||
if '+mpi' in spec:
|
||||
options.extend(['MFEM_USE_MPI=YES'])
|
||||
|
||||
if '+suite-sparse' in spec:
|
||||
ssp = spec['suite-sparse'].prefix
|
||||
ss_lib = '-L%s' % ssp.lib
|
||||
ss_lib += (' -lumfpack -lcholmod -lcolamd -lamd -lcamd' +
|
||||
' -lccolamd -lsuitesparseconfig')
|
||||
' -lccolamd -lsuitesparseconfig')
|
||||
|
||||
no_librt_archs = ['darwin-i686', 'darwin-x86_64']
|
||||
no_rt = any(map(lambda a: spec.satisfies('='+a), no_librt_archs))
|
||||
if not no_rt: ss_lib += ' -lrt'
|
||||
no_rt = any(map(lambda a: spec.satisfies('=' + a),
|
||||
no_librt_archs))
|
||||
if not no_rt:
|
||||
ss_lib += ' -lrt'
|
||||
ss_lib += (' ' + metis_lib + ' ' + lapack_lib)
|
||||
|
||||
options.extend(['MFEM_USE_SUITESPARSE=YES',
|
||||
@@ -125,10 +136,11 @@ def install(self, spec, prefix):
|
||||
'SUITESPARSE_OPT=-I%s' % ssp.include,
|
||||
'SUITESPARSE_LIB=%s' % ss_lib])
|
||||
|
||||
if '+debug' in spec: options.extend(['MFEM_DEBUG=YES'])
|
||||
if '+debug' in spec:
|
||||
options.extend(['MFEM_DEBUG=YES'])
|
||||
|
||||
# Dirty hack to cope with URL redirect
|
||||
tgz_file = string.split(self.url,'/')[-1]
|
||||
tgz_file = string.split(self.url, '/')[-1]
|
||||
tar = which('tar')
|
||||
tar('xzvf', tgz_file)
|
||||
cd(glob.glob('mfem*')[0])
|
||||
@@ -138,12 +150,12 @@ def install(self, spec, prefix):
|
||||
make('all')
|
||||
|
||||
# Run a small test before installation
|
||||
args = ['-m', join_path('data','star.mesh'), '--no-visualization']
|
||||
args = ['-m', join_path('data', 'star.mesh'), '--no-visualization']
|
||||
if '+mpi' in spec:
|
||||
Executable(join_path(spec['mpi'].prefix.bin,
|
||||
'mpirun'))('-np',
|
||||
'4',
|
||||
join_path('examples','ex1p'),
|
||||
join_path('examples', 'ex1p'),
|
||||
*args)
|
||||
else:
|
||||
Executable(join_path('examples', 'ex1'))(*args)
|
||||
|
Reference in New Issue
Block a user