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
|
# Useful directories within the prefix are encapsulated in
|
||||||
# a Prefix object.
|
# a Prefix object.
|
||||||
m.prefix = pkg.prefix
|
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.
|
# Kick off the stage first.
|
||||||
self.do_stage()
|
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 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)
|
tty.msg("No patches needed for %s." % self.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -686,7 +689,7 @@ def do_patch(self):
|
|||||||
tty.msg("Already patched %s" % self.name)
|
tty.msg("Already patched %s" % self.name)
|
||||||
return
|
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():
|
for spec, patch_list in self.patches.items():
|
||||||
if self.spec.satisfies(spec):
|
if self.spec.satisfies(spec):
|
||||||
for patch in patch_list:
|
for patch in patch_list:
|
||||||
@ -704,6 +707,11 @@ def do_patch(self):
|
|||||||
os.remove(bad_file)
|
os.remove(bad_file)
|
||||||
touch(good_file)
|
touch(good_file)
|
||||||
|
|
||||||
|
if has_patch_fun:
|
||||||
|
self.patch()
|
||||||
|
|
||||||
|
tty.msg("Patched %s" % self.name)
|
||||||
|
|
||||||
|
|
||||||
def do_install(self, **kwargs):
|
def do_install(self, **kwargs):
|
||||||
"""This class should call this version of the install method.
|
"""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)
|
spack.install_layout.make_path_for_spec(self.spec)
|
||||||
|
|
||||||
# Set up process's build environment before running install.
|
# Set up process's build environment before running install.
|
||||||
build_env.set_compiler_environment_variables(self)
|
build_env.setup_package(self)
|
||||||
build_env.set_build_environment_variables(self)
|
|
||||||
build_env.set_module_variables_for_package(self)
|
|
||||||
|
|
||||||
if fake_install:
|
if fake_install:
|
||||||
mkdirp(self.prefix.bin)
|
mkdirp(self.prefix.bin)
|
||||||
|
Loading…
Reference in New Issue
Block a user