-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.py
36 lines (29 loc) · 865 Bytes
/
make.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
#!/usr/bin/env python3
# pls excuse my terrible python code
import shutil, sys, platform, os
if platform.system() == "Windows":
type = ".exe"
if platform.system() == "Linux" or "Darwin":
type = ""
# https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
def exists(cmd):
return shutil.which(cmd) is not None
if exists("node") == False:
if exists("yarn") == False:
sys.exit("neither node or yarn is installed (needed for the js part of this code)")
if exists("npm") == False:
sys.exit("npm not found")
if exists("node") == True:
jsexec = "node"
if exists("yarn") == True:
jsexec = "yarn"
if exists("gcc") == False:
sys.exit("gcc wasn't found")
if jsexec == "node":
os.system("npm install")
else:
os.system("yarn")
try:
os.mkdir("bin")
except OSError as error:
print(error)