From 3686c250ed61473a0de456d9c7aed98c3187724b Mon Sep 17 00:00:00 2001 From: becker33 Date: Thu, 18 Jan 2018 17:55:44 -0800 Subject: Fix type issues with setting flag handlers (#6960) The flag_handlers method was being set as a bound method, but when reset in the package.py file it was being set as an unbound method (all python2 issues). This gets the underlying function information, which is the same in either case. The bug was uncovered for parmetis in #6858. This is a partial fix. Included are changes to the parmetis package.py file to make use of flag_handlers. --- var/spack/repos/builtin/packages/parmetis/package.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py index dacd218f99..86fee57abb 100644 --- a/var/spack/repos/builtin/packages/parmetis/package.py +++ b/var/spack/repos/builtin/packages/parmetis/package.py @@ -53,6 +53,13 @@ class Parmetis(CMakePackage): # https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/ # NOQA: E501 patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch') + def flag_handler(self, name, flags): + if name == 'cflags': + if '%pgi' in self.spec: + my_flags = flags + ['-c11'] + return (None, None, my_flags) + return (None, None, flags) + def url_for_version(self, version): url = 'http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis' if version < Version('3.2.0'): @@ -68,9 +75,7 @@ class Parmetis(CMakePackage): '-DGKLIB_PATH:PATH=%s/GKlib' % spec['metis'].prefix.include, '-DMETIS_PATH:PATH=%s' % spec['metis'].prefix, '-DCMAKE_C_COMPILER:STRING=%s' % spec['mpi'].mpicc, - '-DCMAKE_CXX_COMPILER:STRING=%s' % spec['mpi'].mpicxx, - '-DCMAKE_C_FLAGS:STRING=%s' % ( - '-c11' if '%pgi' in spec else ''), + '-DCMAKE_CXX_COMPILER:STRING=%s' % spec['mpi'].mpicxx ]) if '+shared' in spec: -- cgit v1.2.3-60-g2f50