flake8 fixes for petsc

This commit is contained in:
Denis Davydov 2016-06-15 18:32:42 +02:00
parent 6d714e4425
commit 6390acc660

View File

@ -28,8 +28,9 @@
class Petsc(Package): class Petsc(Package):
""" """
PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications PETSc is a suite of data structures and routines for the scalable
modeled by partial differential equations. (parallel) solution of scientific applications modeled by partial
differential equations.
""" """
homepage = "http://www.mcs.anl.gov/petsc/index.html" homepage = "http://www.mcs.anl.gov/petsc/index.html"
@ -71,8 +72,9 @@ class Petsc(Package):
depends_on('hdf5+mpi', when='+hdf5+mpi') depends_on('hdf5+mpi', when='+hdf5+mpi')
depends_on('parmetis', when='+metis+mpi') depends_on('parmetis', when='+metis+mpi')
# Hypre does not support complex numbers. # Hypre does not support complex numbers.
# Also PETSc prefer to build it without internal superlu, likely due to conflict in headers # Also PETSc prefer to build it without internal superlu, likely due to
# see https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py # conflict in headers see
# https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py # NOQA: ignore=E501
depends_on('hypre~internal-superlu', when='+hypre+mpi~complex') depends_on('hypre~internal-superlu', when='+hypre+mpi~complex')
depends_on('superlu-dist@:4.3', when='@:3.6.4+superlu-dist+mpi') depends_on('superlu-dist@:4.3', when='@:3.6.4+superlu-dist+mpi')
depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi') depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi')
@ -83,17 +85,17 @@ def mpi_dependent_options(self):
if '~mpi' in self.spec: if '~mpi' in self.spec:
compiler_opts = [ compiler_opts = [
'--with-cc=%s' % os.environ['CC'], '--with-cc=%s' % os.environ['CC'],
'--with-cxx=%s' % (os.environ['CXX'] if self.compiler.cxx is not None else '0'), '--with-cxx=%s' % (os.environ['CXX'] if self.compiler.cxx is not None else '0'), # NOQA: ignore=E501
'--with-fc=%s' % (os.environ['FC'] if self.compiler.fc is not None else '0'), '--with-fc=%s' % (os.environ['FC'] if self.compiler.fc is not None else '0'), # NOQA: ignore=E501
'--with-mpi=0' '--with-mpi=0'
] ]
error_message_fmt = '\t{library} support requires "+mpi" to be activated' error_message_fmt = '\t{library} support requires "+mpi" to be activated' # NOQA: ignore=E501
# If mpi is disabled (~mpi), it's an error to have any of these enabled. # If mpi is disabled (~mpi), it's an error to have any of these
# This generates a list of any such errors. # enabled. This generates a list of any such errors.
errors = [error_message_fmt.format(library=x) errors = [error_message_fmt.format(library=x)
for x in ('hdf5', 'hypre', 'parmetis','mumps','superlu-dist') for x in ('hdf5', 'hypre', 'parmetis', 'mumps', 'superlu-dist') # NOQA: ignore=E501
if ('+'+x) in self.spec] if ('+' + x) in self.spec]
if errors: if errors:
errors = ['incompatible variants given'] + errors errors = ['incompatible variants given'] + errors
raise RuntimeError('\n'.join(errors)) raise RuntimeError('\n'.join(errors))
@ -108,26 +110,31 @@ def install(self, spec, prefix):
options = ['--with-ssl=0'] options = ['--with-ssl=0']
options.extend(self.mpi_dependent_options()) options.extend(self.mpi_dependent_options())
options.extend([ options.extend([
'--with-precision=%s' % ('double' if '+double' in spec else 'single'), '--with-precision=%s' % ('double' if '+double' in spec else 'single'), # NOQA: ignore=E501
'--with-scalar-type=%s' % ('complex' if '+complex' in spec else 'real'), '--with-scalar-type=%s' % ('complex' if '+complex' in spec else 'real'), # NOQA: ignore=E501
'--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'), '--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'),
'--with-debugging=%s' % ('1' if '+debug' in spec else '0'), '--with-debugging=%s' % ('1' if '+debug' in spec else '0'),
'--with-blas-lapack-dir=%s' % spec['lapack'].prefix '--with-blas-lapack-dir=%s' % spec['lapack'].prefix
]) ])
# Activates library support if needed # Activates library support if needed
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis','mumps','scalapack'): for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis',
'mumps', 'scalapack'):
options.append( options.append(
'--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0')) '--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0')) # NOQA: ignore=E501
) )
if library in spec: if library in spec:
options.append( options.append(
'--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix) '--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix) # NOQA: ignore=E501
) )
# PETSc does not pick up SuperluDist from the dir as they look for superlu_dist_4.1.a # PETSc does not pick up SuperluDist from the dir as they look for
# superlu_dist_4.1.a
if 'superlu-dist' in spec: if 'superlu-dist' in spec:
options.extend([ options.extend([
'--with-superlu_dist-include=%s' % spec['superlu-dist'].prefix.include, '--with-superlu_dist-include=%s' %
'--with-superlu_dist-lib=%s' % join_path(spec['superlu-dist'].prefix.lib, 'libsuperlu_dist.a'), spec['superlu-dist'].prefix.include,
'--with-superlu_dist-lib=%s' %
join_path(spec['superlu-dist'].prefix.lib,
'libsuperlu_dist.a'),
'--with-superlu_dist=1' '--with-superlu_dist=1'
]) ])
else: else: