aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Filippov <alekseyf@google.com>2018-03-11 23:24:34 +0000
committerAleksey Filippov <alekseyf@google.com>2018-03-11 23:36:04 +0000
commit093bdcafc9a2a2602f8da7da3a010958cbb7d155 (patch)
tree74c942255d9eef6211433551a08363de395116f6
parente4faf396e62813665e44fc742e7f355ad532f4d2 (diff)
downloadmeson-093bdcafc9a2a2602f8da7da3a010958cbb7d155.zip
meson-093bdcafc9a2a2602f8da7da3a010958cbb7d155.tar.gz
meson-093bdcafc9a2a2602f8da7da3a010958cbb7d155.tar.bz2
Use subprocess.check_output() instead of Popen().communicate()
-rwxr-xr-xtest cases/common/72 build always/version_gen.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/test cases/common/72 build always/version_gen.py b/test cases/common/72 build always/version_gen.py
index e5a0c2c..17e613e 100755
--- a/test cases/common/72 build always/version_gen.py
+++ b/test cases/common/72 build always/version_gen.py
@@ -6,14 +6,10 @@ def generate(infile, outfile, fallback):
workdir = os.path.split(infile)[0]
if workdir == '':
workdir = '.'
- version = fallback
try:
- p = subprocess.Popen(['git', 'describe'], cwd=workdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- (stdo, _) = p.communicate()
- if p.returncode == 0:
- version = stdo.decode().strip()
+ version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip()
except Exception:
- pass
+ version = fallback
with open(infile) as f:
newdata = f.read().replace('@VERSION@', version)
try: