[Bf-blender-cvs] [cd5c7063031] master: Blender manpage generator: use blender build date instead of current time.

Bastien Montagne noreply at git.blender.org
Wed Sep 18 23:04:55 CEST 2019


Commit: cd5c706303180effac32e09c13a286f730ad9777
Author: Bastien Montagne
Date:   Wed Sep 18 22:59:40 2019 +0200
Branches: master
https://developer.blender.org/rBcd5c706303180effac32e09c13a286f730ad9777

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.

===================================================================

M	doc/manpage/blender.1.py

===================================================================

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



More information about the Bf-blender-cvs mailing list