summaryrefslogtreecommitdiff
path: root/scripts/setupcommon.py
diff options
context:
space:
mode:
authorGyorgy Orban <o.gyorgy@gmail.com>2017-10-23 11:22:56 +0200
committerGyorgy Orban <o.gyorgy@gmail.com>2017-11-01 09:59:32 +0100
commitbb54a954fe58c45d4fb8e2a25833ecc1d0f422f2 (patch)
treed86bad4b1a96a6b9db265b3e0caf4324e2af8d9e /scripts/setupcommon.py
parent385337eb90966706960c618b75c9e6854fea1bcf (diff)
downloadqutebrowser-bb54a954fe58c45d4fb8e2a25833ecc1d0f422f2.tar.gz
qutebrowser-bb54a954fe58c45d4fb8e2a25833ecc1d0f422f2.zip
use subprocess run
The usage of subprocess.run is recommended since python 3.5. Popen, check_call, call and check_output calls were replaced with run.
Diffstat (limited to 'scripts/setupcommon.py')
-rw-r--r--scripts/setupcommon.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/setupcommon.py b/scripts/setupcommon.py
index 1f85b225f..1832ead86 100644
--- a/scripts/setupcommon.py
+++ b/scripts/setupcommon.py
@@ -51,12 +51,14 @@ def _git_str():
return None
try:
# https://stackoverflow.com/questions/21017300/21017394#21017394
- commit_hash = subprocess.check_output(
+ commit_hash = subprocess.run(
['git', 'describe', '--match=NeVeRmAtCh', '--always', '--dirty'],
- cwd=BASEDIR).decode('UTF-8').strip()
- date = subprocess.check_output(
+ cwd=BASEDIR, check=True,
+ stdout=subprocess.PIPE).stdout.decode('UTF-8').strip()
+ date = subprocess.run(
['git', 'show', '-s', '--format=%ci', 'HEAD'],
- cwd=BASEDIR).decode('UTF-8').strip()
+ cwd=BASEDIR, check=True,
+ stdout=subprocess.PIPE).stdout.decode('UTF-8').strip()
return '{} ({})'.format(commit_hash, date)
except (subprocess.CalledProcessError, OSError):
return None