Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build-configurations.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2020 The Bitcoin developers | # Copyright (c) 2020 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
import argparse | import argparse | ||||
import json | import json | ||||
import os | import os | ||||
from pathlib import Path, PurePath | from pathlib import Path, PurePath | ||||
import signal | import signal | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
from teamcity.messages import TeamcityServiceMessages | |||||
# Default timeout value in seconds. Should be overridden by the | # Default timeout value in seconds. Should be overridden by the | ||||
# configuration file. | # configuration file. | ||||
DEFAULT_TIMEOUT = 1 * 60 * 60 | DEFAULT_TIMEOUT = 1 * 60 * 60 | ||||
if sys.version_info < (3, 6): | if sys.version_info < (3, 6): | ||||
raise SystemError("This script requires python >= 3.6") | raise SystemError("This script requires python >= 3.6") | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | def main(): | ||||
# We will provide the required environment variables | # We will provide the required environment variables | ||||
environment_variables = { | environment_variables = { | ||||
"BUILD_DIR": str(build_directory), | "BUILD_DIR": str(build_directory), | ||||
"CMAKE_PLATFORMS_DIR": git_root.joinpath("cmake", "platforms"), | "CMAKE_PLATFORMS_DIR": git_root.joinpath("cmake", "platforms"), | ||||
"THREADS": str(os.cpu_count() or 1), | "THREADS": str(os.cpu_count() or 1), | ||||
"TOPLEVEL": str(git_root), | "TOPLEVEL": str(git_root), | ||||
} | } | ||||
# Let the user know what build is being run. | |||||
# This makes it easier to retrieve the info from the logs. | |||||
teamcity_messages = TeamcityServiceMessages() | |||||
teamcity_messages.customMessage( | |||||
"Starting build {}".format(args.build), | |||||
status="NORMAL" | |||||
) | |||||
try: | try: | ||||
subprocess.run( | subprocess.run( | ||||
[str(script_path)] + unknown_args, | [str(script_path)] + unknown_args, | ||||
check=True, | check=True, | ||||
cwd=build_directory, | cwd=build_directory, | ||||
env={ | env={ | ||||
**os.environ, | **os.environ, | ||||
**environment_variables, | **environment_variables, | ||||
Show All 24 Lines |