spack.patch: fix type hint circular import (#43041)

This commit is contained in:
Adam J. Stewart 2024-03-06 02:26:44 +01:00 committed by GitHub
parent 00d3066b97
commit 9d962f55b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,7 @@
def apply_patch( def apply_patch(
stage: spack.stage.Stage, patch_path: str, level: int = 1, working_dir: str = "." stage: "spack.stage.Stage", patch_path: str, level: int = 1, working_dir: str = "."
) -> None: ) -> None:
"""Apply the patch at patch_path to code in the stage. """Apply the patch at patch_path to code in the stage.
@ -88,7 +88,7 @@ def __init__(
self.level = level self.level = level
self.working_dir = working_dir self.working_dir = working_dir
def apply(self, stage: spack.stage.Stage) -> None: def apply(self, stage: "spack.stage.Stage") -> None:
"""Apply a patch to source in a stage. """Apply a patch to source in a stage.
Args: Args:
@ -247,7 +247,7 @@ def __init__(
super().__init__(pkg, url, level, working_dir) super().__init__(pkg, url, level, working_dir)
self.url = url self.url = url
self._stage: Optional[spack.stage.Stage] = None self._stage: Optional["spack.stage.Stage"] = None
self.ordering_key = ordering_key self.ordering_key = ordering_key
@ -262,7 +262,7 @@ def __init__(
raise PatchDirectiveError("URL patches require a sha256 checksum") raise PatchDirectiveError("URL patches require a sha256 checksum")
self.sha256 = sha256 self.sha256 = sha256
def apply(self, stage: spack.stage.Stage) -> None: def apply(self, stage: "spack.stage.Stage") -> None:
"""Apply a patch to source in a stage. """Apply a patch to source in a stage.
Args: Args:
@ -278,7 +278,7 @@ def apply(self, stage: spack.stage.Stage) -> None:
return super().apply(stage) return super().apply(stage)
@property @property
def stage(self) -> spack.stage.Stage: def stage(self) -> "spack.stage.Stage":
"""The stage in which to download (and unpack) the URL patch. """The stage in which to download (and unpack) the URL patch.
Returns: Returns: