forked from SMGCommunity/Petari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
100 lines (84 loc) · 2.66 KB
/
setup.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# setup.py -- by shibboleet
# Allows for the easy setup of RVL_SDK and its dependencies
import zipfile
import urllib.request
import os
import sys
import subprocess
import hashlib
def install(what):
subprocess.check_call([sys.executable, '-m', 'pip', 'install', what])
if not os.path.exists("baserom.dol"):
print("baserom.dol does not exist. Place a SMG1 dol named baserom.dol in the root.")
sys.exit(1)
else:
print("Found baserom.dol...")
try:
import capstone
print("Found capstone, continuing...")
except ModuleNotFoundError:
print("Module 'capstone' not installed. Installing...")
install("capstone")
try:
import elftools
print("Found elftools, continuing...")
except ModuleNotFoundError:
print("Module `elftools` not found. Installing...")
install("pyelftools")
try:
import ninja
print("Found ninja, continuing...")
except ModuleNotFoundError:
print("Module 'ninja' not found. Installing...")
install("ninja")
try:
import colorama
print("Found colorama, continuing...")
except ModuleNotFoundError:
print("Module 'colorama' not found. Installing...")
install("colorama")
try:
import pandas
print("Found pandas, continuing...")
except ModuleNotFoundError:
print("Module 'pandas' not found. Installing...")
install("pandas")
try:
import plotly
print("Found plotly, continuing...")
except ModuleNotFoundError:
print("Module 'plotly' not found. Installing...")
install("plotly")
try:
import git
print("Found GitPython, continuing...")
except ModuleNotFoundError:
print("Module 'GitPython' not installed. Installing...")
install("GitPython")
try:
import kaleido
print("Found kaleido, continuing...")
except ModuleNotFoundError:
print("Module 'kaleido' not installed. Installing...")
install("kaleido")
if not os.path.exists("Compilers"):
print("Compilers folder not found, downloading...")
with urllib.request.urlopen("http://shibbo.net/smg/Compilers.zip") as response, open("Compilers.zip", 'wb') as out:
data = response.read()
if hashlib.sha256(data).hexdigest().upper() != "12D439B707D7AECB1BCD5B321DA406310523357128ABADB1493BED212A4A225F":
print("Compilers.zip corrupt")
sys.exit(1)
out.write(data)
if os.path.exists("Compilers.zip"):
os.mkdir("Compilers")
print("Extracting file...")
with zipfile.ZipFile("Compilers.zip", "r") as zip:
zip.extractall("Compilers")
os.remove("Compilers.zip")
else:
print("Compilers.zip failed to download.")
sys.exit(1)
else:
print("Found compilers folder, continuing...")
print("Done.")
sys.exit(1)