-
Notifications
You must be signed in to change notification settings - Fork 0
/
make
executable file
·63 lines (51 loc) · 1.55 KB
/
make
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
#!/usr/bin/env python3
from os import chdir, getcwd, remove, mkdir
from os.path import join, isfile, isdir
from platform import system
from subprocess import call
from shutil import rmtree, copy, copytree
from sys import argv
OUTPUT = "bin"
def build():
""" require pyinstaller """
chdir("src")
output = join(getcwd(), OUTPUT)
if not isdir(output):
print("Creating output directory:", output)
mkdir(output)
exit_code = call("pyinstaller -F --noconsole --onefile transclip.py".split(" "))
print(f"The process has ended with exit code {exit_code}")
if system() == "Windows":
copy("dist/transclip.exe", OUTPUT)
else:
copy("dist/transclip", OUTPUT)
print(join(getcwd(), "resources"), join(getcwd(), OUTPUT))
copytree(join(getcwd(), "resources"), join(join(getcwd(), OUTPUT), "resources"))
def clean():
path = join(join(getcwd(), "src"), OUTPUT)
if isdir(path):
print("Deleting", path)
rmtree(path)
path = join(join(getcwd(), "src"), "build")
if isdir(path):
print("Deleting", path)
rmtree(path)
path = join(join(getcwd(), "src"), "dist")
if isdir(path):
print("Deleting", path)
rmtree(path)
path = join(join(getcwd(), "src"), "transclip.spec")
if isfile(path):
print("Deleting", path)
remove(path)
def main():
del argv[0]
task = argv[0]
if task == "build":
build()
elif task == 'clean':
clean()
else:
print("Task not found")
if __name__ == '__main__':
main()