def tools_install(version: str, destination: str): """ Install demangling tools version VERSION. """ releases = get_tools_releases() version = Version.from_string(version, assumed_source=VersionSource.GITHUB) for release in releases: if release.version == version: if not are_you_sure("deploy tools"): return with TemporaryDirectory(prefix='ce-tools-') as td_str: td = Path(td_str) tar_dest = td / 'tarball.tar.xz' unpack_dest = td / 'tools' unpack_dest.mkdir() download_release_file(release.key, str(tar_dest)) subprocess.check_call([ 'tar', '--strip-components', '1', '-C', str(unpack_dest), '-Jxf', str(tar_dest) ]) subprocess.check_call([ 'rsync', '-a', '--delete-after', f'{unpack_dest}/', f'{destination}/' ]) click.echo(f'Tools updated to {version}') return click.echo(f'Unable to find version {version}')
def deploy_staticfiles(branch, versionfile): print("Deploying static files") downloadfile = versionfile filename = 'deploy.tar.xz' remotefile = branch + '/' + downloadfile download_release_file(remotefile[1:], filename) os.mkdir('deploy') subprocess.call(['tar', '-C', 'deploy', '-Jxf', filename]) os.remove(filename) subprocess.call(['aws', 's3', 'sync', 'deploy/out/dist/dist', 's3://compiler-explorer/dist/cdn']) subprocess.call(['rm', '-Rf', 'deploy'])