-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.py
More file actions
26 lines (23 loc) · 730 Bytes
/
Copy pathpackage.py
File metadata and controls
26 lines (23 loc) · 730 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
# -*- coding: utf-8 -*-
import os
import sys
import zipfile
import shutil
if __name__ == '__main__':
apkFile = sys.argv[1]
apk = apkFile.split('.apk')[0]
emptyFile = 'empty.txt'
f = open(emptyFile, 'w')
f.close
with open('/home/chrischeng/channels.txt', 'r') as f:
contents = f.read()
lines = contents.split('\n')
os.mkdir('./release')
for channel in lines:
destfile = './release/%s_%s.apk' % (apk, channel)
shutil.copy(apkFile, destfile)
zipped = zipfile.ZipFile(destfile, 'a')
channelFile = "META-INF/channel_{channelname}".format(channelname=channel)
zipped.write(emptyFile, channelFile)
zipped.close()
os.remove('./empty.txt')