python/build/toolchain.py: add AnyToolchain for type hints
This commit is contained in:
@ -5,6 +5,7 @@ from typing import cast, BinaryIO, Optional
|
||||
from build.download import download_and_verify
|
||||
from build.tar import untar
|
||||
from build.quilt import push_all
|
||||
from .toolchain import AnyToolchain
|
||||
|
||||
class Project:
|
||||
def __init__(self, url: str, md5: str, installed: str,
|
||||
@ -41,10 +42,10 @@ class Project:
|
||||
self.edits = edits
|
||||
self.use_cxx = use_cxx
|
||||
|
||||
def download(self, toolchain) -> str:
|
||||
def download(self, toolchain: AnyToolchain) -> str:
|
||||
return download_and_verify(self.url, self.md5, toolchain.tarball_path)
|
||||
|
||||
def is_installed(self, toolchain) -> bool:
|
||||
def is_installed(self, toolchain: AnyToolchain) -> bool:
|
||||
tarball = self.download(toolchain)
|
||||
installed = os.path.join(toolchain.install_prefix, self.installed)
|
||||
tarball_mtime = os.path.getmtime(tarball)
|
||||
@ -53,7 +54,7 @@ class Project:
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
def unpack(self, toolchain, out_of_tree: bool=True) -> str:
|
||||
def unpack(self, toolchain: AnyToolchain, out_of_tree: bool=True) -> str:
|
||||
if out_of_tree:
|
||||
parent_path = toolchain.src_path
|
||||
else:
|
||||
@ -74,7 +75,7 @@ class Project:
|
||||
|
||||
return path
|
||||
|
||||
def make_build_path(self, toolchain, lazy: bool=False) -> str:
|
||||
def make_build_path(self, toolchain: AnyToolchain, lazy: bool=False) -> str:
|
||||
path = os.path.join(toolchain.build_path, self.base)
|
||||
if lazy and os.path.isdir(path):
|
||||
return path
|
||||
@ -85,5 +86,5 @@ class Project:
|
||||
os.makedirs(path, exist_ok=True)
|
||||
return path
|
||||
|
||||
def build(self, toolchain) -> None:
|
||||
def build(self, toolchain: AnyToolchain) -> None:
|
||||
self._build(toolchain)
|
||||
|
Reference in New Issue
Block a user