From 86da1311299be28c178b16c3b83844c1374c392d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 14 Jun 2021 15:36:16 -0700 Subject: [PATCH] mesonlib: Fix FileMode type annotations --- mesonbuild/mesonlib/universal.py | 4 ++-- mesonbuild/minstall.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 3714ecdea..94dc0a98c 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -298,8 +298,8 @@ class FileMode: '[r-][w-][xsS-]' # Group perms '[r-][w-][xtT-]') # Others perms - def __init__(self, perms: T.Optional[str] = None, owner: T.Optional[str] = None, - group: T.Optional[str] = None): + def __init__(self, perms: T.Optional[str] = None, owner: T.Union[str, int, None] = None, + group: T.Union[str, int, None] = None): self.perms_s = perms self.perms = self.perms_s_to_bits(perms) self.owner = owner diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index d91f61b6f..9bb5ba775 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -130,7 +130,8 @@ def append_to_log(lf: T.TextIO, line: str) -> None: lf.flush() -def set_chown(path: str, user: T.Optional[str] = None, group: T.Optional[str] = None, +def set_chown(path: str, user: T.Union[str, int, None] = None, + group: T.Union[str, int, None] = None, dir_fd: T.Optional[int] = None, follow_symlinks: bool = True) -> None: # shutil.chown will call os.chown without passing all the parameters # and particularly follow_symlinks, thus we replace it temporary