diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-18 23:59:40 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-19 00:04:23 +0300 |
commit | cd5c706303180effac32e09c13a286f730ad9777 (patch) | |
tree | 09000963abb4131e6c07e9247d0f29c1acb35c4a /doc | |
parent | ea6c9f17bd4929f55632345a8c2173c59b78b22b (diff) |
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.
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manpage/blender.1.py | 14 |
1 files changed, 8 insertions, 6 deletions
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 |