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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-09-08 15:17:58 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-09-08 15:52:33 +0300
commitb6114c38496a87ea7eb6b46f975f8de68ed67d27 (patch)
treeab47d3c819a1bff63f1c6eb85bf08970d38a23d4 /build_files/utils/make_utils.py
parenta566b71333cf9352bc676bbf8df6922d99eeaa81 (diff)
Build: skip Blender repository pull in "make update" when not possible
This prints a more informative message, and is convenient when working with local changes or in a branch where you only need to update submodules or tests.
Diffstat (limited to 'build_files/utils/make_utils.py')
-rwxr-xr-xbuild_files/utils/make_utils.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index d05c1e6f838..9a1f740a393 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -6,7 +6,7 @@ import re
import subprocess
import sys
-def call(cmd):
+def call(cmd, exit_on_error=True):
print(" ".join(cmd))
# Flush to ensure correct order output on Windows.
@@ -14,8 +14,25 @@ def call(cmd):
sys.stderr.flush()
retcode = subprocess.call(cmd)
- if retcode != 0:
- sys.exit(retcode)
+ if exit_on_error and retcode != 0:
+ sys.exit(retcode)
+ return retcode
+
+def check_output(cmd, exit_on_error=True):
+ # Flush to ensure correct order output on Windows.
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ try:
+ output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True)
+ except subprocess.CalledProcessError as e:
+ if exit_on_error:
+ sys.stderr.write(" ".join(cmd))
+ sys.stderr.write(e.output + "\n")
+ sys.exit(e.returncode)
+ output = ""
+
+ return output.strip()
def git_branch_release_version(git_command):
# Test if we are building a specific release version.