Merge pull request #1112 from adamjstewart/features/dependencies

Make spack create automatically add dependencies for build system
This commit is contained in:
Todd Gamblin 2016-06-29 07:57:33 -07:00 committed by GitHub
commit eb388306fd

View File

@ -95,9 +95,9 @@ class ${class_name}(Package):
url = "${url}" url = "${url}"
${versions} ${versions}
${extends}
# FIXME: Add dependencies if this package requires them. # FIXME: Add additional dependencies if required.
# depends_on("foo") ${dependencies}
def install(self, spec, prefix): def install(self, spec, prefix):
${install} ${install}
@ -136,8 +136,18 @@ def setup_parser(subparser):
class ConfigureGuesser(object): class ConfigureGuesser(object):
def __call__(self, stage): def __call__(self, stage):
"""Try to guess the type of build system used by the project. """Try to guess the type of build system used by the project.
Set the appropriate default installation instructions and any Set any necessary build dependencies or extensions.
necessary extensions for Python and R.""" Set the appropriate default installation instructions."""
# Build dependencies and extensions
dependenciesDict = {
'autotools': "# depends_on('foo')",
'cmake': "depends_on('cmake')",
'scons': "depends_on('scons')",
'python': "extends('python')",
'R': "extends('R')",
'unknown': "# depends_on('foo')"
}
# Default installation instructions # Default installation instructions
installDict = { installDict = {
@ -214,16 +224,12 @@ def __call__(self, stage):
self.build_system = build_system self.build_system = build_system
# Set any necessary build dependencies or extensions.
self.dependencies = dependenciesDict[build_system]
# Set the appropriate default installation instructions # Set the appropriate default installation instructions
self.install = installDict[build_system] self.install = installDict[build_system]
# Set any necessary extensions for Python and R
extensions = ''
if build_system in ['python', 'R']:
extensions = "\n extends('{0}')\n".format(build_system)
self.extends = extensions
def guess_name_and_version(url, args): def guess_name_and_version(url, args):
# Try to deduce name and version of the new package from the URL # Try to deduce name and version of the new package from the URL
@ -361,7 +367,7 @@ def create(parser, args):
class_name=mod_to_class(name), class_name=mod_to_class(name),
url=url, url=url,
versions=make_version_calls(ver_hash_tuples), versions=make_version_calls(ver_hash_tuples),
extends=guesser.extends, dependencies=guesser.dependencies,
install=guesser.install)) install=guesser.install))
# If everything checks out, go ahead and edit. # If everything checks out, go ahead and edit.