Add patch function to Package, so that packages can define custom patch functions.
This commit is contained in:
parent
852c1dc286
commit
b3042db755
@ -199,3 +199,10 @@ def set_module_variables_for_package(pkg):
|
||||
# Useful directories within the prefix are encapsulated in
|
||||
# a Prefix object.
|
||||
m.prefix = pkg.prefix
|
||||
|
||||
|
||||
def setup_package(pkg):
|
||||
"""Execute all environment setup routines."""
|
||||
set_compiler_environment_variables(pkg)
|
||||
set_build_environment_variables(pkg)
|
||||
set_module_variables_for_package(pkg)
|
||||
|
@ -662,8 +662,11 @@ def do_patch(self):
|
||||
# Kick off the stage first.
|
||||
self.do_stage()
|
||||
|
||||
# Package can add its own patch function.
|
||||
has_patch_fun = hasattr(self, 'patch') and callable(self.patch)
|
||||
|
||||
# If there are no patches, note it.
|
||||
if not self.patches:
|
||||
if not self.patches and not has_patch_fun:
|
||||
tty.msg("No patches needed for %s." % self.name)
|
||||
return
|
||||
|
||||
@ -686,7 +689,7 @@ def do_patch(self):
|
||||
tty.msg("Already patched %s" % self.name)
|
||||
return
|
||||
|
||||
# Apply all the patches for specs that match this on
|
||||
# Apply all the patches for specs that match this one
|
||||
for spec, patch_list in self.patches.items():
|
||||
if self.spec.satisfies(spec):
|
||||
for patch in patch_list:
|
||||
@ -704,6 +707,11 @@ def do_patch(self):
|
||||
os.remove(bad_file)
|
||||
touch(good_file)
|
||||
|
||||
if has_patch_fun:
|
||||
self.patch()
|
||||
|
||||
tty.msg("Patched %s" % self.name)
|
||||
|
||||
|
||||
def do_install(self, **kwargs):
|
||||
"""This class should call this version of the install method.
|
||||
@ -750,9 +758,7 @@ def do_install(self, **kwargs):
|
||||
spack.install_layout.make_path_for_spec(self.spec)
|
||||
|
||||
# Set up process's build environment before running install.
|
||||
build_env.set_compiler_environment_variables(self)
|
||||
build_env.set_build_environment_variables(self)
|
||||
build_env.set_module_variables_for_package(self)
|
||||
build_env.setup_package(self)
|
||||
|
||||
if fake_install:
|
||||
mkdirp(self.prefix.bin)
|
||||
|
Loading…
Reference in New Issue
Block a user