summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-05-17 17:00:49 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-05-17 17:00:49 -0700
commitd592a1655f8e5dbb02f366c01dd5e05eed98301e (patch)
treebee1c81a2468fe308704bb76e290c759465234da
parent502420ceff7214d11b6956d42f44f22cc8c6ca6e (diff)
parent761c5c845072f2079acaab886aac197798d9fd25 (diff)
downloadspack-d592a1655f8e5dbb02f366c01dd5e05eed98301e.tar.gz
spack-d592a1655f8e5dbb02f366c01dd5e05eed98301e.tar.bz2
spack-d592a1655f8e5dbb02f366c01dd5e05eed98301e.tar.xz
spack-d592a1655f8e5dbb02f366c01dd5e05eed98301e.zip
Merge pull request #961 from xjrc/features/flake8-improvements
Enhancement Proposal: Exempt '@when' Functions from Style Redefinition Errors
-rwxr-xr-xshare/spack/qa/run-flake812
-rw-r--r--var/spack/repos/builtin/packages/scotch/package.py64
2 files changed, 45 insertions, 31 deletions
diff --git a/share/spack/qa/run-flake8 b/share/spack/qa/run-flake8
index 722c7fcba6..44eb0167fb 100755
--- a/share/spack/qa/run-flake8
+++ b/share/spack/qa/run-flake8
@@ -20,10 +20,18 @@ fi
# Check if changed files are flake8 conformant [framework]
changed=$(git diff --name-only develop... | grep '.py$')
-# Exempt url lines in changed packages from overlong line errors.
+# Add approved style exemptions to the changed packages.
for file in $changed; do
if [[ $file = *package.py ]]; then
- perl -i~ -pe 's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/' $file;
+ cp "$file" "$file~"
+
+ # Exempt lines with urls and descriptions from overlong line errors.
+ perl -i -pe 's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/' $file
+ perl -i -pe 's/^(\s*version\(.*\).*)$/\1 # NOQA: ignore=E501/' $file
+ perl -i -pe 's/^(\s*variant\(.*\).*)$/\1 # NOQA: ignore=E501/' $file
+
+ # Exempt '@when' decorated functions from redefinition errors.
+ perl -i -pe 's/^(\s*\@when\(.*\).*)$/\1 # NOQA: ignore=F811/' $file
fi
done
diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py
index e82c3acd42..3abbf3c665 100644
--- a/var/spack/repos/builtin/packages/scotch/package.py
+++ b/var/spack/repos/builtin/packages/scotch/package.py
@@ -22,8 +22,10 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+import os
+import re
from spack import *
-import os, re
+
class Scotch(Package):
"""Scotch is a software package for graph and mesh/hypergraph
@@ -38,10 +40,10 @@ class Scotch(Package):
version('6.0.0', 'c50d6187462ba801f9a82133ee666e8e')
version('5.1.10b', 'f587201d6cf5cf63527182fbfba70753')
- variant('mpi', default=False, description='Activate the compilation of PT-Scotch')
+ variant('mpi', default=False, description='Activate the compilation of parallel libraries')
variant('compression', default=True, description='Activate the posibility to use compressed files')
- variant('esmumps', default=False, description='Activate the compilation of the lib esmumps needed by mumps')
- variant('shared', default=True, description='Build shared libraries')
+ variant('esmumps', default=False, description='Activate the compilation of esmumps needed by mumps')
+ variant('shared', default=True, description='Build a shared version of the library')
depends_on('flex')
depends_on('bison')
@@ -51,7 +53,7 @@ class Scotch(Package):
# NOTE: Versions of Scotch up to version 6.0.0 don't include support for
# building with 'esmumps' in their default packages. In order to enable
# support for this feature, we must grab the 'esmumps' enabled archives
- # from the Scotch hosting site. These alternative archives include a strict
+ # from the Scotch hosting site. These alternative archives include a
# superset of the behavior in their default counterparts, so we choose to
# always grab these versions for older Scotch versions for simplicity.
@when('@:6.0.0')
@@ -62,32 +64,34 @@ class Scotch(Package):
def url_for_version(self, version):
return super(Scotch, self).url_for_version(version)
- # NOTE: Several of the 'esmumps' enabled Scotch releases up to version 6.0.0
- # have broken build scripts that don't properly build 'esmumps' as a separate
- # target, so we need a patch procedure to remove 'esmumps' from existing targets
- # and to add it as a standalone target.
+ # NOTE: Several of the 'esmumps' enabled Scotch releases up to version
+ # 6.0.0 have broken build scripts that don't properly build 'esmumps' as a
+ # separate target, so we need a patch procedure to remove 'esmumps' from
+ # existing targets and to add it as a standalone target.
@when('@:6.0.0')
def patch(self):
makefile_path = os.path.join('src', 'Makefile')
with open(makefile_path, 'r') as makefile:
- esmumps_enabled = any(re.search(r'^esmumps(\s*):(.*)$', line) for line in makefile.readlines())
+ esmumps_enabled = any(re.search(r'^esmumps(\s*):(.*)$', line)
+ for line in makefile.readlines())
if not esmumps_enabled:
mff = FileFilter(makefile_path)
mff.filter(r'^.*((esmumps)|(ptesmumps)).*(install).*$', '')
- makefile_esmumps_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Makefile.esmumps')
+ mfesmumps_dir = os.path.dirname(os.path.realpath(__file__))
+ mfesmumps_path = os.path.join(mfesmumps_dir, 'Makefile.esmumps')
with open(makefile_path, 'a') as makefile:
- makefile.write('\ninclude %s\n' % makefile_esmumps_path)
+ makefile.write('\ninclude %s\n' % mfesmumps_path)
@when('@6.0.1:')
def patch(self):
pass
- # NOTE: Configuration of Scotch is achieved by writing a 'Makefile.inc' file
- # that contains all of the configuration variables and their desired values
- # for the installation. This function writes this file based on the given
- # installation variants.
+ # NOTE: Configuration of Scotch is achieved by writing a 'Makefile.inc'
+ # file that contains all of the configuration variables and their desired
+ # values for the installation. This function writes this file based on
+ # the given installation variants.
def configure(self):
makefile_inc = []
cflags = [
@@ -96,9 +100,9 @@ class Scotch(Package):
'-DSCOTCH_DETERMINISTIC',
'-DSCOTCH_RENAME',
'-DIDXSIZE64'
- ]
+ ]
- ## Library Build Type ##
+ # Library Build Type #
if '+shared' in self.spec:
makefile_inc.extend([
@@ -107,7 +111,7 @@ class Scotch(Package):
'RANLIB = echo',
'AR = $(CC)',
'ARFLAGS = -shared $(LDFLAGS) -o'
- ])
+ ])
cflags.append('-fPIC')
else:
makefile_inc.extend([
@@ -116,21 +120,21 @@ class Scotch(Package):
'RANLIB = ranlib',
'AR = ar',
'ARFLAGS = -ruv '
- ])
+ ])
- ## Compiler-Specific Options ##
+ # Compiler-Specific Options #
if self.compiler.name == 'gcc':
cflags.append('-Drestrict=__restrict')
elif self.compiler.name == 'intel':
cflags.append('-restrict')
+ mpicc_path = self.spec['mpi'].mpicc if '+mpi' in self.spec else 'mpicc'
makefile_inc.append('CCS = $(CC)')
- makefile_inc.append('CCP = %s' %
- (self.spec['mpi'].mpicc if '+mpi' in self.spec else 'mpicc'))
+ makefile_inc.append('CCP = %s' % mpicc_path)
makefile_inc.append('CCD = $(CCS)')
- ## Extra Features ##
+ # Extra Features #
ldflags = []
@@ -143,8 +147,10 @@ class Scotch(Package):
makefile_inc.append('LDFLAGS = %s' % ' '.join(ldflags))
- ## General Features ##
+ # General Features #
+ flex_path = os.path.join(self.spec['flex'].prefix.bin, 'flex')
+ bison_path = os.path.join(self.spec['bison'].prefix.bin, 'bison')
makefile_inc.extend([
'EXE =',
'OBJ = .o',
@@ -155,10 +161,10 @@ class Scotch(Package):
'MV = mv',
'CP = cp',
'CFLAGS = %s' % ' '.join(cflags),
- 'LEX = %s -Pscotchyy -olex.yy.c' % os.path.join(self.spec['flex'].prefix.bin , 'flex'),
- 'YACC = %s -pscotchyy -y -b y' % os.path.join(self.spec['bison'].prefix.bin, 'bison'),
+ 'LEX = %s -Pscotchyy -olex.yy.c' % flex_path,
+ 'YACC = %s -pscotchyy -y -b y' % bison_path,
'prefix = %s' % self.prefix
- ])
+ ])
with working_dir('src'):
with open('Makefile.inc', 'w') as fh:
@@ -178,7 +184,7 @@ class Scotch(Package):
with working_dir('src'):
for target in targets:
- make(target, parallel=(target!='ptesmumps'))
+ make(target, parallel=(target != 'ptesmumps'))
install_tree('bin', prefix.bin)
install_tree('lib', prefix.lib)