forked from cedricp/ddt4all
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.py
executable file
·73 lines (55 loc) · 1.61 KB
/
package.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
#!/usr/bin/python
import glob
import sys
import options
import os
import zipfile
__author__ = "Cedric PAILLE"
__copyright__ = "Copyright 2016-2017"
__credits__ = []
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Cedric PAILLE"
__email__ = "cedricpaille@gmail.com"
__status__ = "Beta"
_ = options.translator('ddt4all')
def zipdir(dirname):
for root, dirs, files in os.walk(dirname, topdown=False):
for name in files:
filename = os.path.join(root, name)
if ".pyc" in filename or ".DS_Store" in filename:
continue
print("Adding source file %s" % filename)
zip.write(filename)
if not os.path.exists("./Output"):
os.mkdir("./Output")
default_file = "ddt4all.zip"
if sys.platform[:3] == "win":
default_file = "ddt4all_windows.zip"
elif sys.platform[:3] == "dar":
default_file = "ddt4all_macos.zip"
elif sys.platform[:3] == "lin":
default_file = "ddt4all_linux.zip"
zip = zipfile.ZipFile("./Output/" + default_file, mode="w", compression=zipfile.ZIP_DEFLATED, allowZip64=True)
files = glob.glob("*.py")
for file in files:
print(_("Adding source file %s") % file)
zip.write(file)
files = glob.glob("./ddtplugins/*.py")
for file in files:
print(_("Adding plugin file %s") % file)
zip.write(file)
if os.path.exists('./ecu.zip'):
zip.write("./ecu.zip")
if sys.platform[:3] == "win":
zip.write("./DDT4ALL.BAT")
else:
zip.write("./ddt4all.sh")
zip.write("./requirements.txt")
# Need a real python installation
# zipdir("./venv")
zipdir("./icons")
zipdir("./address")
zipdir("./json")
zipdir("./locale")
zip.close()