python: Use universal_newlines to get str from subprocess.

We can replace ‘universal_newlines’ with ‘text’ when we bump our
minimum Python version to 3.7.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-29 17:36:18 -07:00
committed by Tim Abbott
parent 9281dccae4
commit aaa7b766d8
12 changed files with 35 additions and 38 deletions

View File

@@ -25,7 +25,8 @@ def try_git_describe() -> Optional[str]:
['git', 'describe', '--tags', '--match=[0-9]*', '--always', '--dirty', '--long'],
stderr=subprocess.PIPE,
cwd=os.path.join(os.path.dirname(__file__), '..'),
).strip().decode('utf-8')
universal_newlines=True,
).strip()
except (FileNotFoundError, subprocess.CalledProcessError): # nocoverage
return None