From cd5c706303180effac32e09c13a286f730ad9777 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 18 Sep 2019 22:59:40 +0200 Subject: Blender manpage generator: use blender build date instead of current time. It makes much more sense to use the build timestamp of the Blender binary used to generate that manpage, than the current time. As a bonus, when Blender building makes use of the SOURCE_DATE_EPOCH envvar (through CMake, since previous commit), this also propagate automatically to that man page. Inspired by D5756 by Bernhard M. Wiedemann (@bmwiedemann), thanks. --- doc/manpage/blender.1.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'doc/manpage') diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index 4be16c15ec7..7b442f62340 100755 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -34,7 +34,6 @@ import subprocess import sys import time -import datetime def man_format(data): @@ -52,11 +51,14 @@ outfilename = sys.argv[2] cmd = [blender_bin, "--help"] print(" executing:", " ".join(cmd)) -blender_help = subprocess.check_output(cmd).decode(encoding="utf-8") -blender_version = subprocess.check_output([blender_bin, "--version"]).decode(encoding="utf-8").strip() -blender_version = blender_version.split("build")[0].rstrip() -blender_version = blender_version.partition(" ")[2] # remove 'Blender' prefix. -date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y") +blender_help = subprocess.run( + cmd, env={"ASAN_OPTIONS": "exitcode=0"}, check=True, capture_output=True).stdout.decode(encoding="utf-8") +blender_version = subprocess.run( + [blender_bin, "--version"], env={"ASAN_OPTIONS": "exitcode=0"}, check=True, capture_output=True).stdout.decode(encoding="utf-8").strip() +blender_version, blender_date = blender_version.split("build")[0:2] +blender_version = blender_version.rstrip().partition(" ")[2] # remove 'Blender' prefix. +blender_date = blender_date.strip().partition(" ")[2] # remove 'date:' prefix +date_string = time.strftime("%B %d, %Y", time.strptime(blender_date, "%Y-%m-%d")) outfile = open(outfilename, "w") fw = outfile.write -- cgit v1.2.3