summaryrefslogtreecommitdiffstats
path: root/update_latest.py
diff options
context:
space:
mode:
Diffstat (limited to 'update_latest.py')
-rw-r--r--update_latest.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/update_latest.py b/update_latest.py
index 94bf5a2..26bff62 100644
--- a/update_latest.py
+++ b/update_latest.py
@@ -5,9 +5,11 @@ from datetime import date
from email.utils import parsedate
def file_last_modified(path):
- git_time = f"git log -n1 --pretty=%aD {path}".split()
+ git_log = f"git log --pretty=%aD {path}".split()
try:
- mod_time = subprocess.check_output(git_time)
+ ps = subprocess.Popen(git_log, stdout=subprocess.PIPE)
+ mod_time = subprocess.check_output(["tail", "-n1"],
+ stdin=ps.stdout)
except:
# File is not in the git log, no biggie, just blank the date
return None
@@ -30,14 +32,14 @@ for top in dirs:
updates[path] = mktime(t)
print("<html>")
print("<body>")
-print("<h3>LATEST CHANGES</h3>")
+print("<h3>LATEST POSTS</h3>")
print("<ul>")
for f, t in sorted(updates.items(),
key=lambda x: x[1],
reverse=True)[:10]:
#print(f, ctime(t), sep="\t")
if f != "latest.html":
- print(f"\t<li><a href=/{f}>{f.split()[-1]}</a> - Updated: {date.fromtimestamp(t)}</li>")
+ print(f"\t<li><a href=/{f}>{f.split()[-1]}</a> - Published: {date.fromtimestamp(t)}</li>")
print("</ul>")
print("</body>")