summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-06-29 07:57:33 -0700
committerGitHub <noreply@github.com>2016-06-29 07:57:33 -0700
commiteb388306fde0f636e595b5ac5eae37a3c5850f4b (patch)
tree558f7b2d7df0c1c676d6f8c7701910d4054041ad /lib
parentc99663211379389f416c5ba50a759555e2b1f9ec (diff)
parent798dabc8f2b740cb70563fa141beb0ce268ce09a (diff)
downloadspack-eb388306fde0f636e595b5ac5eae37a3c5850f4b.tar.gz
spack-eb388306fde0f636e595b5ac5eae37a3c5850f4b.tar.bz2
spack-eb388306fde0f636e595b5ac5eae37a3c5850f4b.tar.xz
spack-eb388306fde0f636e595b5ac5eae37a3c5850f4b.zip
Merge pull request #1112 from adamjstewart/features/dependencies
Make spack create automatically add dependencies for build system
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/create.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 8cbb367f86..f5f234d7a7 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -95,9 +95,9 @@ class ${class_name}(Package):
url = "${url}"
${versions}
-${extends}
- # FIXME: Add dependencies if this package requires them.
- # depends_on("foo")
+
+ # FIXME: Add additional dependencies if required.
+ ${dependencies}
def install(self, spec, prefix):
${install}
@@ -136,8 +136,18 @@ def setup_parser(subparser):
class ConfigureGuesser(object):
def __call__(self, stage):
"""Try to guess the type of build system used by the project.
- Set the appropriate default installation instructions and any
- necessary extensions for Python and R."""
+ Set any necessary build dependencies or extensions.
+ 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
installDict = {
@@ -214,16 +224,12 @@ class ConfigureGuesser(object):
self.build_system = build_system
+ # Set any necessary build dependencies or extensions.
+ self.dependencies = dependenciesDict[build_system]
+
# Set the appropriate default installation instructions
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):
# 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),
url=url,
versions=make_version_calls(ver_hash_tuples),
- extends=guesser.extends,
+ dependencies=guesser.dependencies,
install=guesser.install))
# If everything checks out, go ahead and edit.