Replace deprecated library function os.popen() with subprocess
os.popen() is deprecated since version 2.6. Resolved with use of subprocess module. Change-Id: Iea9c0501f46c57d809217912fb0f40eb2bc4f111 Closes-Bug: #1529836
This commit is contained in:
parent
816d90f999
commit
c40464514d
@ -19,7 +19,7 @@
|
|||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
# import sys
|
# import sys
|
||||||
import os
|
import subprocess
|
||||||
|
|
||||||
import openstackdocstheme
|
import openstackdocstheme
|
||||||
|
|
||||||
@ -81,10 +81,15 @@ release = '2.1.0'
|
|||||||
# bug_project: Launchpad project to file bugs against.
|
# bug_project: Launchpad project to file bugs against.
|
||||||
# These variables are passed to the logabug code via html_context.
|
# These variables are passed to the logabug code via html_context.
|
||||||
giturl = u'http://git.openstack.org/cgit/openstack/nova/tree/api-guide/source'
|
giturl = u'http://git.openstack.org/cgit/openstack/nova/tree/api-guide/source'
|
||||||
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
|
git_cmd = ["/usr/bin/git", "rev-parse", "HEAD"]
|
||||||
gitsha = os.popen(git_cmd).read().strip('\n')
|
gitsha = subprocess.Popen(
|
||||||
|
git_cmd, stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
|
||||||
|
|
||||||
# source tree
|
# source tree
|
||||||
pwd = os.popen("pwd").read().strip('\n')
|
pwd = subprocess.Popen(
|
||||||
|
"pwd", stdout=subprocess.PIPE).communicate()[0].strip('\n')
|
||||||
|
|
||||||
# html_context allows us to pass arbitrary values into the html template
|
# html_context allows us to pass arbitrary values into the html template
|
||||||
html_context = {"pwd": pwd,
|
html_context = {"pwd": pwd,
|
||||||
"gitsha": gitsha,
|
"gitsha": gitsha,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -194,8 +195,10 @@ html_static_path = ['_static']
|
|||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# using the given strftime format.
|
||||||
#html_last_updated_fmt = '%b %d, %Y'
|
#html_last_updated_fmt = '%b %d, %Y'
|
||||||
git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1"
|
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
||||||
html_last_updated_fmt = os.popen(git_cmd).read()
|
"-n1"]
|
||||||
|
html_last_updated_fmt = subprocess.Popen(
|
||||||
|
git_cmd, stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
|
||||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
# typographically correct entities.
|
# typographically correct entities.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user