Replace deprecated library function os.popen() with subprocess

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

Change-Id: Ifa5f6bbfabf2d5ebfdbee21920aa12c0a8e30517
Closes-Bug: #1529836
This commit is contained in:
caoyue 2016-01-13 19:30:56 +08:00
parent 7773f1eec1
commit 4ca80795b0
1 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@
# limitations under the License.
import os
import subprocess
import sys
import openstackdocstheme
@ -65,8 +66,10 @@ release = '1.0'
# bug_project: Launchpad project to file bugs against.
# These variables are passed to the logabug code via html_context.
giturl = u'http://git.openstack.org/cgit/openstack/senlin/tree/doc/source'
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
gitsha = os.popen(git_cmd).read().strip('\n')
git_cmd = ["/usr/bin/git", "log", "|", "head", "-n1", "|", "cut", "-f2",
"-d'", "'"]
gitsha = subprocess.Popen(git_cmd,
stdout=subprocess.PIPE).communicate()[0]
bug_tag = "docs"
# source tree