diff options
-rw-r--r-- | lib/spack/spack/directory_layout.py | 12 | ||||
-rw-r--r-- | lib/spack/spack/installer.py | 15 | ||||
-rw-r--r-- | lib/spack/spack/test/installer.py | 42 |
3 files changed, 0 insertions, 69 deletions
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 3db001da90..563cf84f4c 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -217,10 +217,6 @@ class DirectoryLayout(object): def create_install_directory(self, spec): _check_concrete(spec) - prefix = self.check_installed(spec) - if prefix: - raise InstallDirectoryAlreadyExistsError(prefix) - # Create install directory with properly configured permissions # Cannot import at top of file from spack.package_prefs import get_package_dir_permissions, get_package_group @@ -597,14 +593,6 @@ class InconsistentInstallDirectoryError(DirectoryLayoutError): message, long_msg) -class InstallDirectoryAlreadyExistsError(DirectoryLayoutError): - """Raised when create_install_directory is called unnecessarily.""" - - def __init__(self, path): - super(InstallDirectoryAlreadyExistsError, self).__init__( - "Install path %s already exists!" % path) - - class SpecReadError(DirectoryLayoutError): """Raised when directory layout can't read a spec.""" diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index eb409caffe..d6a0bcabd7 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -1590,21 +1590,6 @@ class PackageInstaller(object): keep_prefix = keep_prefix or \ (stop_before_phase is None and last_phase is None) - except spack.directory_layout.InstallDirectoryAlreadyExistsError \ - as exc: - tty.debug('Install prefix for {0} exists, keeping {1} in ' - 'place.'.format(pkg.name, pkg.prefix)) - self._update_installed(task) - - # Only terminate at this point if a single build request was - # made. - if task.explicit and single_explicit_spec: - spack.hooks.on_install_failure(task.request.pkg.spec) - raise - - if task.explicit: - exists_errors.append((pkg_id, str(exc))) - except KeyboardInterrupt as exc: # The build has been terminated with a Ctrl-C so terminate # regardless of the number of remaining specs. diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 485fbb1536..37ce6f5bdb 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -14,7 +14,6 @@ import llnl.util.tty as tty import spack.binary_distribution import spack.compilers -import spack.directory_layout as dl import spack.installer as inst import spack.package_prefs as prefs import spack.repo @@ -1167,47 +1166,6 @@ def test_install_read_locked_requeue(install_mockery, monkeypatch, capfd): assert exp in ln -def test_install_dir_exists(install_mockery, monkeypatch): - """Cover capture of install directory exists error.""" - def _install(installer, task): - raise dl.InstallDirectoryAlreadyExistsError(task.pkg.prefix) - - # Ensure raise the desired exception - monkeypatch.setattr(inst.PackageInstaller, '_install_task', _install) - - const_arg = installer_args(['b'], {}) - installer = create_installer(const_arg) - - err = 'already exists' - with pytest.raises(dl.InstallDirectoryAlreadyExistsError, match=err): - installer.install() - - b, _ = const_arg[0] - assert inst.package_id(b.package) in installer.installed - - -def test_install_dir_exists_multi(install_mockery, monkeypatch, capfd): - """Cover capture of install directory exists error for multiple specs.""" - def _install(installer, task): - raise dl.InstallDirectoryAlreadyExistsError(task.pkg.prefix) - - # Skip the actual installation though should never reach it - monkeypatch.setattr(inst.PackageInstaller, '_install_task', _install) - - # Use two packages to ensure multiple specs - const_arg = installer_args(['b', 'c'], {}) - installer = create_installer(const_arg) - - with pytest.raises(inst.InstallError, match='Installation request failed'): - installer.install() - - err = capfd.readouterr()[1] - assert 'already exists' in err - for spec, install_args in const_arg: - pkg_id = inst.package_id(spec.package) - assert pkg_id in installer.installed - - def test_install_skip_patch(install_mockery, mock_fetch): """Test the path skip_patch install path.""" spec_name = 'b' |