package: removed default no-op patch (#4103)

* package: removed default no-op patch fixes #4085

* do_patch: handles NoSuchMethodError nicely
This commit is contained in:
Massimiliano Culpo 2017-07-18 18:53:35 +02:00 committed by becker33
parent 6b2d75a0a6
commit 5a1ee22575

View File

@ -58,6 +58,7 @@
import spack.repository import spack.repository
import spack.url import spack.url
import spack.util.web import spack.util.web
import spack.multimethod
from llnl.util.filesystem import * from llnl.util.filesystem import *
from llnl.util.lang import * from llnl.util.lang import *
@ -939,10 +940,6 @@ def do_stage(self, mirror_only=False):
self.stage.expand_archive() self.stage.expand_archive()
self.stage.chdir_to_source() self.stage.chdir_to_source()
def patch(self):
"""Default patch implementation is a no-op."""
pass
def do_patch(self): def do_patch(self):
"""Calls do_stage(), then applied patches to the expanded tarball if they """Calls do_stage(), then applied patches to the expanded tarball if they
haven't been applied already.""" haven't been applied already."""
@ -1003,6 +1000,10 @@ def do_patch(self):
self.patch() self.patch()
tty.msg("Ran patch() for %s" % self.name) tty.msg("Ran patch() for %s" % self.name)
patched = True patched = True
except spack.multimethod.NoSuchMethodError:
# We are running a multimethod without a default case.
# If there's no default it means we don't need to patch.
tty.msg("No patches needed for %s" % self.name)
except: except:
tty.msg("patch() function failed for %s" % self.name) tty.msg("patch() function failed for %s" % self.name)
touch(bad_file) touch(bad_file)