-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrezbuild.py
49 lines (35 loc) · 1.04 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
49
import os
import sys
import shutil
import subprocess
url_prefix = "https://github.com/MoonShineVFX/pyblish-qml/archive"
filename = "1.11.4.p1.zip"
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)
os.makedirs(dst)
# Download the source
url = "%s/%s" % (url_prefix, filename)
archive = lib.download(url, filename)
# Unzip the source
source_root = lib.open_archive(archive)
# Deploy
subprocess.check_call([
"python",
"setup.py",
"build",
"--build-base",
dst
], cwd=source_root)
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:])