-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
53 lines (47 loc) · 2.13 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
45
46
47
48
49
50
51
52
import os
import sys
import shutil
curDir = os.path.dirname(__file__)
if os.path.isdir(curDir+"\\temp"):
shutil.rmtree(curDir+"\\temp")
if not os.path.isdir(curDir+"\\dist"):
os.mkdir("dist")
shutil.copytree(curDir+"\\src", curDir+"\\temp")
os.remove(curDir+"\\temp\\res\\css\\style.css.map")
os.remove(curDir+"\\temp\\res\\css\\style.scss")
os.remove(curDir+"\\temp\\res\\heknows.png")
if sys.argv[1] == "xpi":
if os.path.exists("ecsta-firefox.zip"):
os.remove("ecsta-firefox.zip")
shutil.copy(curDir+"\\manifest.xpi.json", curDir+"\\temp\\manifest.json")
shutil.make_archive("ecsta-firefox", "zip", curDir+"\\temp")
shutil.move("ecsta-firefox.zip",curDir+"\\dist\\ecsta-firefox.zip")
shutil.rmtree(curDir+"\\temp")
print('Built for Firefox! :D')
else:
if sys.argv[1] == "crx":
if os.path.exists("ecsta-chromium.zip"):
os.remove("ecsta-chromium.zip")
shutil.copy(curDir+"\\manifest.crx.json", curDir+"\\temp\\manifest.json")
shutil.make_archive("ecsta-chromium", "zip", curDir+"\\temp")
shutil.move("ecsta-chromium.zip",curDir+"\\dist\\ecsta-chromium.zip")
shutil.rmtree(curDir+"\\temp")
print('Built for Chromium! :D')
else:
if sys.argv[1] == "both":
if os.path.exists("ecsta-chromium.zip"):
os.remove("ecsta-chromium.zip")
if os.path.exists("ecsta-firefox.zip"):
os.remove("ecsta-firefox.zip")
shutil.copy(curDir+"\\manifest.crx.json", curDir+"\\temp\\manifest.json")
shutil.make_archive("ecsta-chromium", "zip", curDir+"\\temp")
shutil.move("ecsta-chromium.zip",curDir+"\\dist\\ecsta-chromium.zip")
print('Chromium done..')
shutil.copy(curDir+"\\manifest.xpi.json", curDir+"\\temp\\manifest.json")
shutil.make_archive("ecsta-firefox", "zip", curDir+"\\temp")
shutil.move("ecsta-firefox.zip",curDir+"\\dist\\ecsta-firefox.zip")
shutil.rmtree(curDir+"\\temp")
print('Built for Firefox and Chromium! :D')
else:
shutil.rmtree(curDir+"\\temp")
print('Build failed')