From 57a5722ba7553fc482b0e59f10aea93a5f26d724 Mon Sep 17 00:00:00 2001 From: kshea21 Date: Tue, 11 Feb 2025 15:16:19 -0800 Subject: [PATCH] some style things --- lib/spack/spack/build_environment.py | 1 + lib/spack/spack/installer.py | 7 ++----- lib/spack/spack/test/installer.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 3ad6bb15b96..34aa83730bf 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -38,6 +38,7 @@ import os import re import signal +import stat import sys import traceback import types diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 30c61b0c45f..ba77afdb27a 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -1131,7 +1131,7 @@ def install_action(self: "Task") -> InstallAction: # If the install prefix is missing, warn about it, and proceed with # normal install. - if not os.path.exists(task.pkg.prefix): + if not os.path.exists(self.pkg.prefix): tty.debug("Missing installation to overwrite") return InstallAction.INSTALL @@ -1276,9 +1276,6 @@ def complete(self): assert ( self.started or self.no_op ), "Can't call `complete()` before `start()` or identified no-operation task" - # seeing if I can get rid of that assertion because in some cases we will need to - # complete the task so that we can raise the errors even though a process was never - # started because saving the error made it exit the function before a process could be started install_args = self.request.install_args pkg = self.pkg tests = install_args.get("tests") @@ -2350,7 +2347,7 @@ def install(self) -> None: failure = self.complete_task(task, install_status) if failure: failed_build_requests.append(failure) - except: + except Exception as e: # Terminate any active child processes if there's an installation error for task in active_tasks: if task.process_handle is not None: diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index abb0f1b0257..88675ad2f29 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -727,7 +727,7 @@ def test_installing_task_use_cache(install_mockery, monkeypatch): task = create_build_task(request.pkg) monkeypatch.setattr(inst, "_install_from_cache", _true) - installer.install() + installer.start_task(task, , None) assert request.pkg_id in installer.installed