Replace deprecated library function os.popen() with subprocess

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

Change-Id: I445291d05ea12b0a1747225ea24e2986288ead86
This commit is contained in:
Luong Anh Tuan
2018-05-23 09:01:35 +07:00
parent 735e8d251a
commit 0b4044912e

View File

@@ -13,6 +13,7 @@
# flake8: noqa
import subprocess
import sys
import os
@@ -136,8 +137,10 @@ html_extra_path = ['_extra']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
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 = str(subprocess.Popen(
git_cmd, stdout=subprocess.PIPE).communicate()[0])
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.