-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenvironment_setup.py
More file actions
72 lines (49 loc) · 1.87 KB
/
environment_setup.py
File metadata and controls
72 lines (49 loc) · 1.87 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import os
import requests
import zipfile
def download_file(url, path):
r = requests.get(url, stream=True)
with open(path, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
if os.path.exists(path):
return True
else:
return False
def get_applications_path():
applications_path = os.path.join(os.path.dirname(__file__), "applications")
if not os.path.exists(applications_path):
os.makedirs(applications_path)
return applications_path
def install_djv():
applications_path = get_applications_path()
application_path = os.path.join(applications_path, "djv-1.1.0-Windows-64")
path = os.path.join(applications_path, "djv.zip")
if not os.path.exists(application_path) and not os.path.exists(path):
print "Installing DJV..."
url = "https://downloads.sourceforge.net/project/djv/djv-stable/1.1.0/"
url += "djv-1.1.0-Windows-64.zip"
download_file(url, path)
zip_ref = zipfile.ZipFile(path, "r")
zip_ref.extractall(applications_path)
zip_ref.close()
os.remove(path)
def install_alshaders():
applications_path = get_applications_path()
application_path = os.path.join(
applications_path, "alShaders-win-2.0.0b2-ai5.0.1.0"
)
path = os.path.join(applications_path, "alshaders.zip")
if not os.path.exists(application_path) and not os.path.exists(path):
print "Installing AlShaders..."
url = "https://github.com/anderslanglands/alShaders2/releases/"
url += "download/2.0.0-beta2/alShaders-win-2.0.0b2-ai5.0.1.0.zip"
download_file(url, path)
zip_ref = zipfile.ZipFile(path, "r")
zip_ref.extractall(application_path)
zip_ref.close()
os.remove(path)
if __name__ == "__main__":
install_djv()
install_alshaders()