forked from oxalica/rust-overlay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrust-installer.py
More file actions
27 lines (25 loc) · 1.1 KB
/
rust-installer.py
File metadata and controls
27 lines (25 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# The install script for rust components.
# Some toolchains have tons of install directives which makes bash script too slow.
import os
from pathlib import Path
from shutil import copy, copytree
out = Path(os.environ['out'])
verbose = os.environ.get('VERBOSE_INSTALL') == '1'
installer_version = int(Path('./rust-installer-version').read_text().strip())
if installer_version == 3:
for component in Path('./components').read_text().splitlines():
print(f'Installing component {component}')
for directive in (Path(component) / 'manifest.in').read_text().splitlines():
cmd, file = directive.split(':')
in_file, out_file = Path(component) / file, out / file
out_file.parent.mkdir(parents=True, exist_ok=True)
if verbose:
print(f'Installing {cmd}: {file}')
if cmd == 'file':
copy(in_file, out_file)
elif cmd == 'dir':
copytree(in_file, out_file)
else:
assert False, f'Unknown command: {cmd}'
else:
assert False, f'Unknown installer version: {installer_version}'