Skip to content

Commit ca3ec3e

Browse files
committed
zip-img: factor out for main() python calling
1 parent f75bf6f commit ca3ec3e

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

release

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/usr/bin/env python3
2+
3+
import os
24
import subprocess
5+
36
import common
4-
subprocess.check_call(['./build-all'])
5-
subprocess.check_call(['./zip-img'])
7+
zip_img = imp.load_source('zip_img', os.path.join(common.root_dir, 'zip-img'))
8+
9+
subprocess.check_call([os.path.join(common.root_dir, 'build-all')])
10+
zip_img.main()
611
tag = 'sha-{}'.format(common.sha)
7-
subprocess.check_call(['git', 'tag' tag])
12+
subprocess.check_call(['git', 'tag', tag])
813
subprocess.check_call(['git', 'push' '--tags'])
914
# TODO
1015
# - https://stackoverflow.com/questions/41022470/curl-request-to-add-file-to-github-release

zip-img

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ import zipfile
66

77
import common
88

9-
outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha))
10-
if os.path.exists(outfile):
11-
os.unlink(outfile)
12-
zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED)
13-
for arch in common.arches:
14-
common.setup(common.get_argparse(default_args={'arch': arch}))
15-
zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir))
16-
zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir))
17-
zipf.close()
9+
def main():
10+
outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha))
11+
if os.path.exists(outfile):
12+
os.unlink(outfile)
13+
zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED)
14+
for arch in common.arches:
15+
common.setup(common.get_argparse(default_args={'arch': arch}))
16+
zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir))
17+
zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir))
18+
zipf.close()
19+
20+
if __name__ == '__main__':
21+
main()

0 commit comments

Comments
 (0)