blob: 96e74d55e37ce495b46e591b64e154b3d7fa0300 (
plain) (
blame)
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
|
import sys
import zipfile
import os
import re
def prepare_path(path):
return ('file:/' + path.lstrip('/')) if os.path.isabs(path) else path
def main(args):
bf, mf = args[0], args[1]
if not os.path.exists(os.path.dirname(mf)):
os.makedirs(os.path.dirname(mf))
with open(bf) as f:
class_path = f.read().strip()
class_path = ' '.join(map(prepare_path, class_path.split('\n')))
with zipfile.ZipFile(mf, 'w') as zf:
lines = []
while class_path:
lines.append(class_path[:60])
class_path = class_path[60:]
if lines:
zf.writestr('META-INF/MANIFEST.MF', 'Manifest-Version: 1.0\nClass-Path: \n ' + '\n '.join(lines) + ' \n\n')
if __name__ == '__main__':
main(sys.argv[1:])
|