-
Notifications
You must be signed in to change notification settings - Fork 233
/
package.py
31 lines (27 loc) · 959 Bytes
/
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
import zipfile
import os
import sys
root_folder = os.path.dirname(__file__)
addon_folder = os.path.join(root_folder, 'distribute', 'sverchok')
target_folder = os.path.join(root_folder)
file_excludes = [".directory",
".DS",
"__MACOSX",
"kdev4",
"~"]
def zipfolder(foldername, target_dir):
zipobj = zipfile.ZipFile(foldername + '.zip', 'w', zipfile.ZIP_DEFLATED)
rootlen = len(target_dir) + 1
for base, dirs, files in os.walk(target_dir):
files_list = []
for f in files:
for ex in file_excludes:
if ex in f:
break
files_list.append(f)
for file in files_list:
if "sverchok" in base and "__pycache__" not in base and "kdev4" not in base:
fn = os.path.join(base, file)
zipobj.write(fn, fn[rootlen:])
#zipfolder(addon_folder, target_folder)
#sys.exit()