Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-09-19 16:54:13 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-09-19 16:57:33 +0300
commitcb5ed2e5f458190cbea2ba41d00f7fe001ab00a7 (patch)
treefcb5a3f72adcf665faadc8b6ba4b2d0cd9be90b5 /doc/manpage
parent815ca2310fb4a1cb27befdef04842f2bf6a9ea51 (diff)
Manpage gen script: fix for python < 3.7, and missing Blender build info.
Python3.7 is still fairly recent, not all distro use it as system python yet, fallback to code compatible up to py3.5. Also, often distro builds of Blender do not have the buildinfo, in that case fallback to `SOURCE_DATE_EPOCH` envvar, and as last resort to current time, as in orig patch D5756 (we still use blender builddate when available). Issues raised in recent own rBcd5c70630318.
Diffstat (limited to 'doc/manpage')
-rwxr-xr-xdoc/manpage/blender.1.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py
index 113429cbcb4..fc2200ab859 100755
--- a/doc/manpage/blender.1.py
+++ b/doc/manpage/blender.1.py
@@ -30,6 +30,7 @@ and <output-filename> is where to write the generated man page.
# <pep8 compliant>
+import os
import subprocess
import sys
@@ -52,13 +53,17 @@ outfilename = sys.argv[2]
cmd = [blender_bin, "--help"]
print(" executing:", " ".join(cmd))
blender_help = subprocess.run(
- cmd, env={"ASAN_OPTIONS": "exitcode=0"}, check=True, capture_output=True).stdout.decode(encoding="utf-8")
+ cmd, env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).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_bin, "--version"], env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8").strip()
+blender_version, blender_date = (blender_version.split("build") + [None, None])[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"))
+if blender_date is None:
+ # Happens when built without WITH_BUILD_INFO e.g.
+ date_string = time.strftime("%B %d, %Y", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
+else:
+ 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