Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build-configurations.py
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | def __init__(self, configuration, project_root): | ||||
if self.logs["clean_log"].is_file(): | if self.logs["clean_log"].is_file(): | ||||
self.logs["clean_log"].unlink() | self.logs["clean_log"].unlink() | ||||
self.logs["full_log"] = self.build_directory.joinpath("build.full.log") | self.logs["full_log"] = self.build_directory.joinpath("build.full.log") | ||||
if self.logs["full_log"].is_file(): | if self.logs["full_log"].is_file(): | ||||
self.logs["full_log"].unlink() | self.logs["full_log"].unlink() | ||||
def copy_artifacts(self, artifacts): | def copy_artifacts(self, artifacts): | ||||
if self.artifact_dir.is_dir(): | |||||
shutil.rmtree(self.artifact_dir) | |||||
self.artifact_dir.mkdir(exist_ok=True) | |||||
# Find and copy artifacts. | # Find and copy artifacts. | ||||
# The source is relative to the build tree, the destination relative to | # The source is relative to the build tree, the destination relative to | ||||
# the artifact directory. | # the artifact directory. | ||||
# The artifact directory is located in the build directory tree, results | # The artifact directory is located in the build directory tree, results | ||||
# from it needs to be excluded from the glob matches to prevent infinite | # from it needs to be excluded from the glob matches to prevent infinite | ||||
# recursion. | # recursion. | ||||
for pattern, dest in artifacts.items(): | for pattern, dest in artifacts.items(): | ||||
matches = [m for m in sorted(self.build_directory.glob( | matches = [m for m in sorted(self.build_directory.glob( | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | async def wait_for_build(self, timeout, args=[]): | ||||
str(self.test_logs_dir.relative_to(self.build_directory)): "", | str(self.test_logs_dir.relative_to(self.build_directory)): "", | ||||
} | } | ||||
self.copy_artifacts(artifacts) | self.copy_artifacts(artifacts) | ||||
return (return_code, message) | return (return_code, message) | ||||
def run(self, args=[]): | def run(self, args=[]): | ||||
if self.artifact_dir.is_dir(): | |||||
shutil.rmtree(self.artifact_dir) | |||||
self.artifact_dir.mkdir(exist_ok=True) | |||||
return_code, message = asyncio.run( | return_code, message = asyncio.run( | ||||
self.wait_for_build( | self.wait_for_build( | ||||
self.configuration.get( | self.configuration.get( | ||||
"timeout", DEFAULT_TIMEOUT)) | "timeout", DEFAULT_TIMEOUT)) | ||||
) | ) | ||||
return (return_code, message) | return (return_code, message) | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |