-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
44 lines (37 loc) · 1.14 KB
/
build.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
import os
import sys
import zipfile
import urllib.request
from tkinter import Tk
from tkinter.filedialog import askdirectory
Tk().withdraw()
print("Choose installation location.")
dir = askdirectory()
tmp = os.path.join(dir, "tmp")
file = "fourier_visualizer-"
print("Installing...")
try:
urllib.request.urlretrieve("https://github.com/ArjunSahlot/fourier_visualizer/archive/main.zip", tmp)
file += "main"
except urllib.error.HTTPError:
urllib.request.urlretrieve("https://github.com/ArjunSahlot/fourier_visualizer/archive/master.zip", tmp)
file += "master"
print("Unzipping")
with zipfile.ZipFile(tmp, 'r') as zip:
zip.extractall(dir)
print("Cleaning up")
final = os.path.join(dir, file.split("-")[0])
os.rename(os.path.join(dir, file), final)
os.remove(os.path.join(tmp))
with open(os.path.join(final, "requirements.txt"), "r") as f:
packages = f.read().split("\n")
if sys.platform == "windows":
cmd = "pip install "
else:
cmd = "pip3 install "
print("Installing packages")
for package in packages:
if "n" in input(f"Install" + package + "? [y/n] ").lower():
continue
os.system(cmd.format(package))
print("Done!")