-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbundle.py
42 lines (32 loc) · 1.02 KB
/
bundle.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
#!/usr/bin/env python
import common
import zipfile
import glob
def make_zip():
print('Scanning for files...')
files = set(glob.glob('*') + glob.glob('**/*', recursive=True))
excluded = set(glob.glob('.*'))
print('Excluding .gitignore...')
with open('.gitignore') as gitignore:
for line in gitignore:
line = line.strip()
excluded = excluded.union(glob.glob(line))
if '*' in line:
excluded = excluded.union(glob.glob('**/' + line, recursive=True))
zipname = common.FONT_NAME + '_font.zip'
files = files.difference(excluded)
files = files.union(['.gitignore'])
files = files.difference([zipname])
print('Creating zip...')
with zipfile.ZipFile(zipname, 'w') as zf:
for file in files:
print(file + '...')
zf.write(file)
print('...OK.')
print('')
print('Saved to "' + zipname + '"!')
print('')
print('DONE.')
if __name__ == '__main__':
import sys
make_zip()