Skip to content

Commit c374f21

Browse files
committed
Add Build.py
1 parent 4da3779 commit c374f21

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.dist-info
2+
*.alfredworkflow
23

34
# Byte-compiled / optimized / DLL files
45
__pycache__/

Build.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/python
2+
# encoding: utf-8
3+
4+
from os import walk
5+
from os.path import join
6+
from zipfile import ZipFile
7+
8+
FILENAME_LIST = (
9+
'info.plist',
10+
11+
'entry_point.py',
12+
'core.py',
13+
14+
)
15+
16+
PATH_LIST = (
17+
'workflow',
18+
'arrow',
19+
'backports',
20+
'dateutil',
21+
)
22+
23+
24+
def main():
25+
with open('version') as f:
26+
version = f.readline().rstrip('\n\r ')
27+
28+
zip_filename = 'time-converter.{}.alfredworkflow'.format(version)
29+
z = ZipFile(zip_filename, mode='w')
30+
31+
for filename in FILENAME_LIST:
32+
z.write(filename)
33+
34+
for pathname in PATH_LIST:
35+
for root, dirs, files in walk(pathname):
36+
for filename in files:
37+
if filename.rfind('.pyc') == -1:
38+
z.write(join(root, filename))
39+
40+
z.close()
41+
42+
print('Create Alfred workflow({}) finished.'.format(zip_filename))
43+
44+
45+
if __name__ == '__main__':
46+
main()

version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

0 commit comments

Comments
 (0)