-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
49 lines (36 loc) · 1.45 KB
/
install.py
File metadata and controls
49 lines (36 loc) · 1.45 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
import sys
import functools
import subprocess
from gitz import git, lib
REZ_URL = "https://github.com/getblessing/rez.git"
def install_rez(dst):
rezsrc = "build/rezsrc"
git.clone(REZ_URL, rezsrc)
if os.path.isdir(dst):
lib.clean(dst)
os.makedirs(dst)
subprocess.check_call([sys.executable, "install.py", "-v", dst],
cwd=rezsrc)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("location", nargs="?", const=True, default=None,
help="Rez install path if you want to install it in "
"custom path. If no path given, Rez will be "
"installed in '~/rez/core'. Directory will be "
"removed if exists.")
parser.add_argument("--yes", action="store_true",
help="Yes to all.")
opt = parser.parse_args()
location = functools.reduce(lambda path, f: f(path),
[opt.location or "~/rez/core",
os.path.expanduser,
os.path.expandvars,
os.path.normpath])
print("Rez will be installed to %s" % location)
print("Directory will be removed if exists.")
if opt.yes or lib.confirm("Do you want to continue ? [Y/n]\n"):
install_rez(location)
else:
print("Cancelled")