You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2021/10/27 09:36:01 UTC
[buildstream] 01/01: Update mypy to 0.910
This is an automated email from the ASF dual-hosted git repository.
juergbi pushed a commit to branch juerg/mypy
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 4fe08f92c6a69734f3898f0a17c77e46ae937832
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Wed Oct 27 09:18:25 2021 +0200
Update mypy to 0.910
mypy 0.730 is not compatible with Python 3.9, resulting in the following
bogus error message:
https://github.com/python/mypy/issues/4125
---
src/buildstream/plugin.py | 4 ++--
src/buildstream/plugins/sources/tar.py | 3 ++-
src/buildstream/plugins/sources/workspace.py | 6 +++---
tox.ini | 6 +++++-
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py
index 6a8b221..f8ffd1e 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 *"<major>.<minor>"*, where the
@@ -278,7 +278,7 @@ class Plugin:
__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 9e53ea6..e1ec2a2 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 df24abb..70a8274 100644
--- a/src/buildstream/plugins/sources/workspace.py
+++ b/src/buildstream/plugins/sources/workspace.py
@@ -93,10 +93,10 @@ class WorkspaceSource(Source):
# 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 @@ class WorkspaceSource(Source):
# Plugin entry point
-def setup() -> WorkspaceSource:
+def setup():
return WorkspaceSource
diff --git a/tox.ini b/tox.ini
index c06d17b..79b46e8 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