diff --git a/lib/spack/spack/cmd/setup.py b/lib/spack/spack/cmd/setup.py index 50bc031330..15bd5e6562 100644 --- a/lib/spack/spack/cmd/setup.py +++ b/lib/spack/spack/cmd/setup.py @@ -23,6 +23,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import argparse +import copy import os import string import sys @@ -30,10 +31,11 @@ import llnl.util.tty as tty import spack import spack.cmd +import spack.cmd.install as install +from llnl.util.filesystem import set_executable from spack import which from spack.cmd.edit import edit_package from spack.stage import DIYStage -from llnl.util.filesystem import set_executable description = "Create a configuration script and module, but don't build." @@ -163,4 +165,26 @@ def setup(self, args): # TODO: make this an argument, not a global. spack.do_checksum = False + # Install dependencies if requested to do so + if not args.ignore_deps: + parser = argparse.ArgumentParser() + install.setup_parser(parser) + inst_args = copy.deepcopy(args) + inst_args = parser.parse_args( + ['--only=dependencies'] + args.spec, + namespace=inst_args + ) + install.install(parser, inst_args) + # Generate spconfig.py + tty.msg( + 'Generating spconfig.py [{0}]'.format(package.spec.cshort_spec) + ) write_spconfig(package) + # Install this package to register it in the DB and permit + # module file regeneration + inst_args = copy.deepcopy(args) + inst_args = parser.parse_args( + ['--only=package', '--fake'] + args.spec, + namespace=inst_args + ) + install.install(parser, inst_args) diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py index 8611dc2026..d079188db6 100644 --- a/var/spack/repos/builtin/packages/gromacs/package.py +++ b/var/spack/repos/builtin/packages/gromacs/package.py @@ -25,7 +25,7 @@ from spack import * -class Gromacs(Package): +class Gromacs(CMakePackage): """GROMACS (GROningen MAchine for Chemical Simulations) is a molecular dynamics package primarily designed for simulations of proteins, lipids and nucleic acids. It was originally developed in the Biophysical @@ -64,28 +64,22 @@ def patch(self): if '+plumed' in self.spec: self.spec['plumed'].package.apply_patch(self) - def install(self, spec, prefix): + def cmake_args(self): options = [] - if '+mpi' in spec: + if '+mpi' in self.spec: options.append('-DGMX_MPI:BOOL=ON') - if '+double' in spec: + if '+double' in self.spec: options.append('-DGMX_DOUBLE:BOOL=ON') - if '~shared' in spec: + if '~shared' in self.spec: options.append('-DBUILD_SHARED_LIBS:BOOL=OFF') - if '+debug' in spec: + if '+debug' in self.spec: options.append('-DCMAKE_BUILD_TYPE:STRING=Debug') else: options.append('-DCMAKE_BUILD_TYPE:STRING=Release') - options.extend(std_cmake_args) - - with working_dir('spack-build', create=True): - - cmake('..', *options) - make() - make('install') + return options