From b411ba3e5016f3f9ed04ba773f2dd0bc41721095 Mon Sep 17 00:00:00 2001 From: LiuNanke Date: Sun, 10 Jan 2016 04:45:57 +0800 Subject: [PATCH] Replace deprecated library function os.popen() with subprocess os.popen() is deprecated since version 2.6. Resolved with use of subprocess module. Closes-bug: #1529836 Change-Id: I0f9d46e5402fcb809575163a27448d9463b703b0 --- doc/source/conf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index a28d3a0ab..9485fc2f6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,6 +13,7 @@ # under the License. import os +import subprocess import sys on_rtd = os.environ.get('READTHEDOCS', None) == 'True' @@ -85,8 +86,10 @@ if not on_rtd: # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' -git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1" -html_last_updated_fmt = os.popen(git_cmd).read() +git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", + "-n1"] +html_last_updated_fmt = subprocess.Popen( + git_cmd, stdout=subprocess.PIPE).communicate()[0] # The name for this set of Sphinx documents. If None, it defaults to