From 6d63fc0061d295c39038b23c302cccc96c7563bf Mon Sep 17 00:00:00 2001 From: David McMackins II Date: Wed, 29 Jul 2015 08:27:43 -0500 Subject: Fixed missing import and moved manifest text to its own variable for readability --- jarsnap.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jarsnap.py b/jarsnap.py index d5fca13..d1d0104 100644 --- a/jarsnap.py +++ b/jarsnap.py @@ -18,14 +18,14 @@ from datetime import datetime from getopt import GetoptError, gnu_getopt -from os import mkdir, remove, rename +from os import listdir, mkdir, remove, rename from os.path import join, exists from shutil import copy, make_archive, rmtree, unpack_archive from sys import argv from tempfile import gettempdir __title__ = 'jarsnap.py' -__version__ = '1.1.0' +__version__ = '1.1.1' __author__ = 'David McMackins II' def make_fat_jar(jars, main_class, output_path='fat.jar', data=[]): @@ -37,6 +37,12 @@ def make_fat_jar(jars, main_class, output_path='fat.jar', data=[]): meta_inf = join(workdir, 'META-INF') mkdir(meta_inf) + manifest = '''Manifest-Version: 1.0 +Created-By: {} {} on {} +Main-Class: {} + +'''.replace('\n', '\r\n').format(__title__, __version__, now, main_class) + try: for jar in jars: unpack_archive(jar, workdir, 'zip') @@ -49,10 +55,7 @@ def make_fat_jar(jars, main_class, output_path='fat.jar', data=[]): remove(join(meta_inf, f)) with open(join(meta_inf, 'MANIFEST.MF'), 'w') as mf: - mf.write('Manifest-Version: 1.0\r\n' - + 'Created-By: {} {}, {}\r\n'.format(__title__, - __version__, now) - + 'Main-Class: {}\r\n\r\n'.format(main_class)) + mf.write(manifest) out_name = make_archive(output_path, 'zip', root_dir=workdir) rename(out_name, output_path) -- cgit v1.2.3