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.
This commit is contained in:
becker33
2018-01-18 17:55:44 -08:00
committed by scheibelp
parent 568db965cf
commit 3686c250ed
3 changed files with 35 additions and 5 deletions

View File

@@ -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 @@ def cmake_args(self):
'-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: