Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build-configurations.py
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | def copy_artifacts(self, artifacts): | ||||
# If there are multiple files or a single directory, destination is a | # If there are multiple files or a single directory, destination is a | ||||
# directory. | # directory. | ||||
dest.mkdir(parents=True, exist_ok=True) | dest.mkdir(parents=True, exist_ok=True) | ||||
for match in matches: | for match in matches: | ||||
if match.is_file(): | if match.is_file(): | ||||
shutil.copy2(match, dest) | shutil.copy2(match, dest) | ||||
else: | else: | ||||
# FIXME after python => 3.8 is enforced, avoid the | |||||
# try/except block and use dirs_exist_ok=True instead. | |||||
try: | |||||
shutil.copytree(match, dest.joinpath(match.name)) | shutil.copytree(match, dest.joinpath(match.name)) | ||||
except FileExistsError: | |||||
pass | |||||
def print_line_to_logs(self, line): | def print_line_to_logs(self, line): | ||||
# Always print to the full log | # Always print to the full log | ||||
with open(self.logs["full_log"], 'a', encoding='utf-8') as log: | with open(self.logs["full_log"], 'a', encoding='utf-8') as log: | ||||
log.write(line) | log.write(line) | ||||
# Discard the set -x bash output for stdout and the clean log | # Discard the set -x bash output for stdout and the clean log | ||||
if not line.startswith("+"): | if not line.startswith("+"): | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |