-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathpackage.py
More file actions
33 lines (24 loc) · 760 Bytes
/
package.py
File metadata and controls
33 lines (24 loc) · 760 Bytes
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
import zipfile
import glob
import os
options = {
"summary": False
}
def PackageName(name, version):
if(type(version) is str):
return "%s_%s.zip" % (name, version)
else:
return "%s_v%d.%d.%d.zip" % (name, *version)
pkgFile = PackageName("Blender-CoD", (0, 5, 2))
# Create the package archive
file = zipfile.ZipFile(pkgFile, "w")
# Add the detected files to the archive
for name in glob.iglob("io_scene_cod/**/*.py", recursive=True):
file.write(name, name, zipfile.ZIP_DEFLATED)
file.close()
# Print a file summary if requested
if(options["summary"]):
file = zipfile.ZipFile(pkgFile, "r")
for info in file.infolist():
print(info.filename, info.date_time,
info.file_size, info.compress_size)