diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py index 6a8b22133..f8ffd1ef3 100644 --- a/src/buildstream/plugin.py +++ b/src/buildstream/plugin.py @@ -213,7 +213,7 @@ class Plugin: which are included in the buildstream namespace. """ - BST_MIN_VERSION = None + BST_MIN_VERSION: Optional[str] = None """The minimum required version of BuildStream required by this plugin. The version must be expressed as the string *"."*, where the @@ -278,7 +278,7 @@ class Foo(Source): __TABLE = WeakValueDictionary() # type: WeakValueDictionary[int, Plugin] try: - __multiprocessing_context = multiprocessing.get_context("forkserver") + __multiprocessing_context: multiprocessing.context.BaseContext = multiprocessing.get_context("forkserver") except ValueError: # We are on a system without `forkserver` support. Let's default to # spawn. This seems to be hanging however in some rare cases. diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py index 9e53ea6a6..e1ec2a256 100644 --- a/src/buildstream/plugins/sources/tar.py +++ b/src/buildstream/plugins/sources/tar.py @@ -72,7 +72,8 @@ class ReadableTarInfo(tarfile.TarInfo): so that the owner-read bit is always set. """ - @property + # https://github.com/python/mypy/issues/4125 + @property # type: ignore def mode(self): # Respect umask instead of the file mode stored in the archive. # The only bit used from the embedded mode is the executable bit for files. diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py index df24abb91..70a82746f 100644 --- a/src/buildstream/plugins/sources/workspace.py +++ b/src/buildstream/plugins/sources/workspace.py @@ -93,10 +93,10 @@ def set_ref(self, ref: SourceRef, node: MappingNode) -> None: # init_workspace() # # Raises AssertionError: existing workspaces should not be reinitialized - def init_workspace(self, directory: Directory) -> None: + def init_workspace(self, directory: str) -> None: raise AssertionError("Attempting to re-open an existing workspace") - def fetch(self) -> None: # pylint: disable=arguments-differ + def fetch(self, *, previous_sources_dir=None) -> None: # pylint: disable=arguments-differ pass # pragma: nocover def stage(self, directory): @@ -133,5 +133,5 @@ def __do_stage(self, directory: Directory) -> None: # Plugin entry point -def setup() -> WorkspaceSource: +def setup(): return WorkspaceSource diff --git a/tox.ini b/tox.ini index c06d17ba7..79b46e8f2 100644 --- a/tox.ini +++ b/tox.ini @@ -159,7 +159,11 @@ skip_install = True commands = mypy {posargs} deps = - mypy==0.730 + mypy==0.910 + types-protobuf + types-python-dateutil + types-setuptools + types-ujson -rrequirements/requirements.txt -rrequirements/dev-requirements.txt