add quotes to type annotation
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
4a153a185b
commit
8d0923f29e
@ -75,6 +75,7 @@
|
||||
|
||||
_fail_fast_err = "Terminating after first install failure"
|
||||
|
||||
|
||||
class BuildStatus(enum.Enum):
|
||||
"""Different build (task) states."""
|
||||
|
||||
@ -123,6 +124,7 @@ class ExecuteResult(enum.Enum):
|
||||
# task is not ready for installation (locked by another process)
|
||||
NO_OP = enum.auto()
|
||||
|
||||
|
||||
class InstallAction(enum.Enum):
|
||||
#: Don't perform an install
|
||||
NONE = enum.auto()
|
||||
@ -1067,7 +1069,6 @@ def flag_installed(self, installed: List[str]) -> None:
|
||||
level=2,
|
||||
)
|
||||
|
||||
|
||||
def _setup_install_dir(self, pkg: "spack.package_base.PackageBase") -> None:
|
||||
"""
|
||||
Create and ensure proper access controls for the install directory.
|
||||
@ -1182,9 +1183,8 @@ def priority(self):
|
||||
"""The priority is based on the remaining uninstalled dependencies."""
|
||||
return len(self.uninstalled_deps)
|
||||
|
||||
def check_db(
|
||||
spec: "spack.spec.Spec"
|
||||
) -> Tuple[Optional[spack.database.InstallRecord], bool]:
|
||||
|
||||
def check_db(spec: "spack.spec.Spec") -> Tuple[Optional[spack.database.InstallRecord], bool]:
|
||||
"""Determine if the spec is flagged as installed in the database
|
||||
|
||||
Args:
|
||||
@ -1204,10 +1204,11 @@ def check_db(
|
||||
installed_in_db = False
|
||||
return rec, installed_in_db
|
||||
|
||||
|
||||
class BuildTask(Task):
|
||||
"""Class for representing a build task for a package."""
|
||||
|
||||
process_handle: spack.build_environment.ProcessHandle = None
|
||||
process_handle: "spack.build_environment.ProcessHandle" = None
|
||||
started: bool = False
|
||||
no_op: bool = False
|
||||
|
||||
@ -1262,7 +1263,9 @@ def start(self):
|
||||
def poll(self):
|
||||
"""Check if task has successfully executed, caused an InstallError,
|
||||
or the child process has information ready to receive."""
|
||||
assert self.started or self.no_op, "Can't call `poll()` before `start()` or identified no-operation task"
|
||||
assert (
|
||||
self.started or self.no_op
|
||||
), "Can't call `poll()` before `start()` or identified no-operation task"
|
||||
return self.no_op or self.success_result or self.error_result or self.process_handle.poll()
|
||||
|
||||
def complete(self):
|
||||
@ -1270,7 +1273,9 @@ def complete(self):
|
||||
Complete the installation of the requested spec and/or dependency
|
||||
represented by the build task.
|
||||
"""
|
||||
assert self.started or self.no_op, "Can't call `complete()` before `start()` or identified no-operation task"
|
||||
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
|
||||
@ -1518,7 +1523,6 @@ def _add_init_task(
|
||||
|
||||
self._push_task(task)
|
||||
|
||||
|
||||
def _check_deps_status(self, request: BuildRequest) -> None:
|
||||
"""Check the install status of the requested package
|
||||
|
||||
@ -2116,8 +2120,9 @@ def _init_queue(self) -> None:
|
||||
task.add_dependent(dependent_id)
|
||||
self.all_dependencies = all_dependencies
|
||||
|
||||
|
||||
def start_task(self, task: Task, install_status: InstallStatus, term_status: TermStatusLine) -> None:
|
||||
def start_task(
|
||||
self, task: Task, install_status: InstallStatus, term_status: TermStatusLine
|
||||
) -> None:
|
||||
"""Attempts to start a package installation."""
|
||||
pkg, pkg_id, spec = task.pkg, task.pkg_id, task.pkg.spec
|
||||
install_status.next_pkg(pkg)
|
||||
@ -2281,14 +2286,11 @@ def complete_task(self, task: Task, install_status: InstallStatus) -> Optional[T
|
||||
# lower levels -- skip printing if already printed.
|
||||
# TODO: sort out this and SpackError.print_context()
|
||||
tty.error(
|
||||
f"Failed to install {pkg.name} due to "
|
||||
f"{exc.__class__.__name__}: {str(exc)}"
|
||||
f"Failed to install {pkg.name} due to " f"{exc.__class__.__name__}: {str(exc)}"
|
||||
)
|
||||
# Terminate if requested to do so on the first failure.
|
||||
if self.fail_fast:
|
||||
raise spack.error.InstallError(
|
||||
f"{_fail_fast_err}: {str(exc)}", pkg=pkg
|
||||
) from exc
|
||||
raise spack.error.InstallError(f"{_fail_fast_err}: {str(exc)}", pkg=pkg) from exc
|
||||
|
||||
# Terminate when a single build request has failed, or summarize errors later.
|
||||
if task.is_build_request:
|
||||
@ -2357,7 +2359,6 @@ def install(self) -> None:
|
||||
finally:
|
||||
active_tasks.remove(task)
|
||||
|
||||
|
||||
self._clear_removed_tasks()
|
||||
if self.build_pq:
|
||||
task = self._pop_task()
|
||||
@ -2640,6 +2641,7 @@ def build_process(pkg: "spack.package_base.PackageBase", install_args: dict) ->
|
||||
with spack.util.path.filter_padding():
|
||||
return installer.run()
|
||||
|
||||
|
||||
def overwrite_process(pkg: "spack.package_base.PackageBase", install_args: dict) -> bool:
|
||||
# TODO:I don't know if this comment accurately reflects what's going on anymore
|
||||
# TODO: think it should move to the error handling
|
||||
@ -2650,6 +2652,7 @@ def overwrite_process(pkg: "spack.package_base.PackageBase", install_args: dict)
|
||||
with fs.replace_directory_transaction(pkg.prefix):
|
||||
return build_process(pkg, install_args)
|
||||
|
||||
|
||||
def deprecate(spec: "spack.spec.Spec", deprecator: "spack.spec.Spec", link_fn) -> None:
|
||||
"""Deprecate this package in favor of deprecator spec"""
|
||||
# Here we assume we don't deprecate across different stores, and that same hash
|
||||
|
Loading…
Reference in New Issue
Block a user