Replace deprecated library function os.popen() with subprocess

os.popen() is deprecated since version 2.6. Resolved with use of
subprocess module.

Change-Id: I895f12807b3823f649369f27495c9182f01a7a14
This commit is contained in:
wangqi 2018-05-17 13:43:22 +00:00
parent cac7f2c183
commit 40771a06c0
2 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@
import os
import sys
import subprocess
import openstackdocstheme
@ -51,7 +52,8 @@ if current_series == "latest":
suse_series = previous_series_name.capitalize()
else:
watermark = series_names = current_series.capitalize()
latest_tag = os.popen('git describe --abbrev=0 --tags').read().strip('\n')
git_cmd = ["git", "describe", "--abbrev=0", "--tags"]
latest_tag = subprocess.Popen(git_cmd,stdout=subprocess.PIPE).communicate()[0].strip('\n')
rdo_series = current_series_name
suse_series = current_series_name.capitalize()

View File

@ -26,6 +26,7 @@ import imp
import os
import re
import sys
import subprocess
import openstackdocstheme
@ -53,7 +54,8 @@ if current_series == "latest":
upgrade_warning = "Upgrading to master is not recommended. Master is under heavy development, and is not stable."
else:
watermark = series_names = current_series.capitalize()
latest_tag = os.popen('git describe --abbrev=0 --tags').read().strip('\n')
git_cmd = ["git", "describe", "--abbrev=0", "--tags"]
latest_tag = subprocess.Popen(git_cmd,stdout=subprocess.PIPE).communicate()[0].strip('\n')
branch = "stable/{}".format(current_series)
upgrade_warning = "The upgrade is always under active development."