diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-26 22:05:38 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-26 22:08:09 -0500 |
commit | d73e81c77b842d386ebdfe4fc984fea364ca51b8 (patch) | |
tree | d97114ab04f68cc87e77cccd52fa4987f54be8c8 /mesonbuild/mesonlib | |
parent | dd4e7120243edb2030c6558cf657a504bef7e9b7 (diff) | |
download | meson-d73e81c77b842d386ebdfe4fc984fea364ca51b8.zip meson-d73e81c77b842d386ebdfe4fc984fea364ca51b8.tar.gz meson-d73e81c77b842d386ebdfe4fc984fea364ca51b8.tar.bz2 |
Popen_safe and wrappers can accept os.PathLike for cwd
Do not require users to convert it to a string first. This is a waste of
time and effort for exactly the same results.
Diffstat (limited to 'mesonbuild/mesonlib')
-rw-r--r-- | mesonbuild/mesonlib/universal.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 1e3f54e..27d1240 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -185,14 +185,14 @@ class GitException(MesonException): self.output = output.strip() if output else '' GIT = shutil.which('git') -def git(cmd: T.List[str], workingdir: str, check: bool = False, **kwargs: T.Any) -> T.Tuple[subprocess.Popen, str, str]: +def git(cmd: T.List[str], workingdir: T.Union[str, bytes, os.PathLike], check: bool = False, **kwargs: T.Any) -> T.Tuple[subprocess.Popen, str, str]: cmd = [GIT] + cmd p, o, e = Popen_safe(cmd, cwd=workingdir, **kwargs) if check and p.returncode != 0: raise GitException('Git command failed: ' + str(cmd), e) return p, o, e -def quiet_git(cmd: T.List[str], workingdir: str, check: bool = False) -> T.Tuple[bool, str]: +def quiet_git(cmd: T.List[str], workingdir: T.Union[str, bytes, os.PathLike], check: bool = False) -> T.Tuple[bool, str]: if not GIT: m = 'Git program not found.' if check: @@ -203,7 +203,7 @@ def quiet_git(cmd: T.List[str], workingdir: str, check: bool = False) -> T.Tuple return False, e return True, o -def verbose_git(cmd: T.List[str], workingdir: str, check: bool = False) -> bool: +def verbose_git(cmd: T.List[str], workingdir: T.Union[str, bytes, os.PathLike], check: bool = False) -> bool: if not GIT: m = 'Git program not found.' if check: |