diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2021-01-27 02:24:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 09:24:09 +0100 |
commit | aa8e0262420c10baa99d70593ea3dc1ecceef7da (patch) | |
tree | ca607056d3d69d071b3244375c0c1a47f1dd4a88 /lib/spack | |
parent | 0366d49c6e22f7b168be576c47a5bda6cf0f3ccd (diff) | |
download | spack-aa8e0262420c10baa99d70593ea3dc1ecceef7da.tar.gz spack-aa8e0262420c10baa99d70593ea3dc1ecceef7da.tar.bz2 spack-aa8e0262420c10baa99d70593ea3dc1ecceef7da.tar.xz spack-aa8e0262420c10baa99d70593ea3dc1ecceef7da.zip |
spack setup: remove the command for v0.17.0 (#20277)
spack setup was deprecated in 0.16 and will be removed in 0.17
Follow-up to #18240
Diffstat (limited to 'lib/spack')
-rw-r--r-- | lib/spack/spack/cmd/commands.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/cmd/setup.py | 163 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/commands.py | 28 |
3 files changed, 0 insertions, 204 deletions
diff --git a/lib/spack/spack/cmd/commands.py b/lib/spack/spack/cmd/commands.py index ace758d339..e63e162c3f 100644 --- a/lib/spack/spack/cmd/commands.py +++ b/lib/spack/spack/cmd/commands.py @@ -262,20 +262,7 @@ def _commands(parser, args): if args.header and not os.path.exists(args.header): tty.die("No such file: '%s'" % args.header) - # if we're updating an existing file, only write output if a command - # or the header is newer than the file. if args.update: - if os.path.exists(args.update): - files = [ - spack.cmd.get_module(command).__file__.rstrip('c') # pyc -> py - for command in spack.cmd.all_commands()] - if args.header: - files.append(args.header) - last_update = os.path.getmtime(args.update) - if not any(os.path.getmtime(f) > last_update for f in files): - tty.msg('File is up to date: %s' % args.update) - return - tty.msg('Updating file: %s' % args.update) with open(args.update, 'w') as f: prepend_header(args, f) diff --git a/lib/spack/spack/cmd/setup.py b/lib/spack/spack/cmd/setup.py deleted file mode 100644 index a49963782f..0000000000 --- a/lib/spack/spack/cmd/setup.py +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import argparse -import copy -import os -import sys - -import llnl.util.tty as tty -from llnl.util.filesystem import set_executable - -import spack.repo -import spack.store -import spack.build_systems.cmake -import spack.cmd -import spack.cmd.install as install -import spack.cmd.common.arguments as arguments -from spack.util.executable import which - -from spack.stage import DIYStage - -description = "create a configuration script and module, but don't build" -section = "build" -level = "long" - - -def setup_parser(subparser): - subparser.add_argument( - '-i', '--ignore-dependencies', action='store_true', dest='ignore_deps', - help="do not try to install dependencies of requested packages") - arguments.add_common_arguments(subparser, ['no_checksum', 'spec']) - subparser.add_argument( - '-v', '--verbose', action='store_true', dest='verbose', - help="display verbose build output while installing") - - cd_group = subparser.add_mutually_exclusive_group() - arguments.add_common_arguments(cd_group, ['clean', 'dirty']) - subparser.epilog = 'DEPRECATED: use `spack dev-build` instead' - - -def write_spconfig(package, dirty): - # Set-up the environment - spack.build_environment.setup_package(package, dirty) - - cmd = [str(which('cmake'))] + package.std_cmake_args + package.cmake_args() - - env = dict() - - paths = os.environ['PATH'].split(':') - paths = [item for item in paths if 'spack/env' not in item] - env['PATH'] = ':'.join(paths) - env['CMAKE_PREFIX_PATH'] = os.environ['CMAKE_PREFIX_PATH'] - env['SPACK_INCLUDE_DIRS'] = os.environ['SPACK_INCLUDE_DIRS'] - env['CC'] = os.environ['SPACK_CC'] - env['CXX'] = os.environ['SPACK_CXX'] - env['FC'] = os.environ['SPACK_FC'] - - setup_fname = 'spconfig.py' - with open(setup_fname, 'w') as fout: - fout.write( - r"""#!%s -# - -import sys -import os -import subprocess - -def cmdlist(str): - return list(x.strip().replace("'",'') for x in str.split('\n') if x) -env = dict(os.environ) -""" % sys.executable) - - env_vars = sorted(list(env.keys())) - for name in env_vars: - val = env[name] - if name.find('PATH') < 0: - fout.write('env[%s] = %s\n' % (repr(name), repr(val))) - else: - if name == 'SPACK_INCLUDE_DIRS': - sep = ';' - else: - sep = ':' - - fout.write( - 'env[%s] = "%s".join(cmdlist("""\n' % (repr(name), sep)) - for part in val.split(sep): - fout.write(' %s\n' % part) - fout.write('"""))\n') - - fout.write('\ncmd = cmdlist("""\n') - fout.write('%s\n' % cmd[0]) - for arg in cmd[1:]: - fout.write(' %s\n' % arg) - fout.write('""") + sys.argv[1:]\n') - fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n') - set_executable(setup_fname) - - -def setup(self, args): - tty.warn('DEPRECATED: use `spack dev-build` instead') - - if not args.spec: - tty.die("spack setup requires a package spec argument.") - - specs = spack.cmd.parse_specs(args.spec) - if len(specs) > 1: - tty.die("spack setup only takes one spec.") - - # Take a write lock before checking for existence. - with spack.store.db.write_transaction(): - spec = specs[0] - if not spack.repo.path.exists(spec.name): - tty.die("No package for '{0}' was found.".format(spec.name), - " Use `spack create` to create a new package") - if not spec.versions.concrete: - tty.die( - "spack setup spec must have a single, concrete version. " - "Did you forget a package version number?") - - spec.concretize() - package = spack.repo.get(spec) - if not isinstance(package, spack.build_systems.cmake.CMakePackage): - tty.die( - 'Support for {0} derived packages not yet implemented'.format( - package.build_system_class)) - - # It's OK if the package is already installed. - - # Forces the build to run out of the current directory. - package.stage = DIYStage(os.getcwd()) - - # disable checksumming if requested - if args.no_checksum: - spack.config.set('config:checksum', False, scope='command_line') - - # 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) - ) - dirty = args.dirty - write_spconfig(package, dirty) - - # 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/lib/spack/spack/test/cmd/commands.py b/lib/spack/spack/test/cmd/commands.py index e70ff792ca..2427511538 100644 --- a/lib/spack/spack/test/cmd/commands.py +++ b/lib/spack/spack/test/cmd/commands.py @@ -118,48 +118,21 @@ def test_rst_with_header(tmpdir): def test_rst_update(tmpdir): update_file = tmpdir.join('output') - # not yet created when commands is run commands('--update', str(update_file)) assert update_file.exists() - with update_file.open() as f: - assert f.read() - - # created but older than commands - with update_file.open('w') as f: - f.write('empty\n') - update_file.setmtime(0) - commands('--update', str(update_file)) - assert update_file.exists() - with update_file.open() as f: - assert f.read() != 'empty\n' - - # newer than commands - with update_file.open('w') as f: - f.write('empty\n') - commands('--update', str(update_file)) - assert update_file.exists() - with update_file.open() as f: - assert f.read() == 'empty\n' def test_update_with_header(tmpdir): update_file = tmpdir.join('output') - # not yet created when commands is run commands('--update', str(update_file)) assert update_file.exists() - with update_file.open() as f: - assert f.read() fake_header = 'this is a header!\n\n' filename = tmpdir.join('header.txt') with filename.open('w') as f: f.write(fake_header) - # created, newer than commands, but older than header - commands('--update', str(update_file), '--header', str(filename)) - - # newer than commands and header commands('--update', str(update_file), '--header', str(filename)) @@ -229,7 +202,6 @@ def test_update_completion_arg(tmpdir, monkeypatch): old_file = old.read() with open(mock_args['bash']['update'], 'w') as mock: mock.write(old_file.replace("--update-completion", "")) - mock_bashfile.setmtime(0) # ensure mtime triggers update monkeypatch.setattr( spack.cmd.commands, 'update_completion_args', mock_args) |