-
Notifications
You must be signed in to change notification settings - Fork 0
/
rezbuild.py
48 lines (32 loc) · 1.16 KB
/
rezbuild.py
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
import os
import sys
import shutil
url_prefix = "https://github.com/MoonShineVFX/reveries-config/archive"
def build(source_path, build_path, install_path, targets=None):
from rezutil import lib
targets = targets or []
if "install" in targets:
dst = install_path + "/payload"
else:
dst = build_path + "/payload"
dst = os.path.normpath(dst)
if os.path.isdir(dst):
shutil.rmtree(dst)
if os.environ["REZ_BUILD_VARIANT_INDEX"] != "0":
filename = "%s-usd.zip" % os.environ["REZ_BUILD_PROJECT_VERSION"]
else:
filename = "%s.zip" % os.environ["REZ_BUILD_PROJECT_VERSION"]
# Download the source
url = "%s/%s" % (url_prefix, filename)
archive = lib.download(url, filename)
# Unzip the source
source_root = lib.open_archive(archive)
# Deploy
shutil.copytree(source_root, dst)
# (TODO) Deploy Deadline scripts
# (or decouple it into another repo)
if __name__ == "__main__":
build(source_path=os.environ["REZ_BUILD_SOURCE_PATH"],
build_path=os.environ["REZ_BUILD_PATH"],
install_path=os.environ["REZ_BUILD_INSTALL_PATH"],
targets=sys.argv[1:])