2019-08-30 14:20:29 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
|
|
|
# Utility functions for make update and make tests.
|
|
|
|
|
2019-08-29 11:13:41 +02:00
|
|
|
import re
|
2019-08-30 14:20:29 +02:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2019-09-08 14:17:58 +02:00
|
|
|
def call(cmd, exit_on_error=True):
|
2019-08-30 14:20:29 +02:00
|
|
|
print(" ".join(cmd))
|
|
|
|
|
|
|
|
# Flush to ensure correct order output on Windows.
|
|
|
|
sys.stdout.flush()
|
|
|
|
sys.stderr.flush()
|
|
|
|
|
|
|
|
retcode = subprocess.call(cmd)
|
2019-09-08 14:17:58 +02:00
|
|
|
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:
|
2019-09-08 18:44:47 +02:00
|
|
|
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
|
2019-09-08 14:17:58 +02:00
|
|
|
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()
|
2019-08-29 11:13:41 +02:00
|
|
|
|
|
|
|
def git_branch_release_version(git_command):
|
|
|
|
# Test if we are building a specific release version.
|
|
|
|
try:
|
|
|
|
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
sys.stderr.write("Failed to get Blender git branch\n")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
branch = branch.strip().decode('utf8')
|
|
|
|
release_version = re.search("^blender-v(.*)-release$", branch)
|
|
|
|
if release_version:
|
|
|
|
release_version = release_version.group(1)
|
|
|
|
return release_version
|
|
|
|
|
|
|
|
def svn_libraries_base_url(release_version):
|
|
|
|
if release_version:
|
|
|
|
svn_branch = "tags/blender-" + release_version + "-release"
|
|
|
|
else:
|
|
|
|
svn_branch = "trunk"
|
|
|
|
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
|