summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McMackins II <contact@mcmackins.org>2015-07-29 08:27:43 -0500
committerDavid McMackins II <contact@mcmackins.org>2015-07-29 08:27:43 -0500
commit6d63fc0061d295c39038b23c302cccc96c7563bf (patch)
tree94bd07b911cd487316a014018361d9305cc40355
parente4fc436bc0da448ea51fc5766069a41fd075b948 (diff)
Fixed missing import and moved manifest text to its own variable for readability1.1.1
-rw-r--r--jarsnap.py15
1 files 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)