-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrezbuild.py
43 lines (28 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
import os
import sys
import shutil
url_prefix = "https://github.com/getblessing/rez-python/releases/download"
payload = "{ver}.payload/Python{ver}_x64_windows.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)
python_version = os.environ["REZ_BUILD_PROJECT_VERSION"]
# Download the source
url = "%s/%s" % (url_prefix, payload.format(ver=python_version))
archive = lib.download(url, os.path.basename(url))
# Unzip the source
source_root = lib.open_archive(archive)
# Deploy
shutil.copytree(source_root, dst)
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:])