diff --git a/setup_app/utils/printVersion.py b/setup_app/utils/printVersion.py index 28e5b334..a10da3f2 100644 --- a/setup_app/utils/printVersion.py +++ b/setup_app/utils/printVersion.py @@ -9,6 +9,7 @@ import ssl import json import argparse +import datetime try: from urllib.request import urlopen @@ -36,8 +37,9 @@ def get_latest_commit(service, branch): def get_war_info(war_fn): retDict = {'title':'', 'version':'', 'build':'', 'buildDate':'', 'branch':''} - war_zip = zipfile.ZipFile(war_fn,"r") - menifest = war_zip.read('META-INF/MANIFEST.MF') + war_zip = zipfile.ZipFile(war_fn, 'r') + menifest_fn = 'META-INF/MANIFEST.MF' + menifest = war_zip.read(menifest_fn) for l in menifest.splitlines(): ls = l.strip().decode('utf-8') @@ -51,16 +53,10 @@ def get_war_info(war_fn): branch = branch.split('/')[1] retDict['branch'] = branch - - for f in war_zip.filelist: - if f.filename.startswith('META-INF/maven/org.gluu') and f.filename.endswith('pom.properties'): - pom_prop = war_zip.read(f.filename) - for l in pom_prop.splitlines(): - build_date = re.findall("\w{3}\s\w{3}\s{1,2}\w{1,2}\s\w{2}:\w{2}:\w{2}\s[+\w]{3}\s\w{4}", l.decode('utf-8')) - if build_date: - retDict['buildDate'] = build_date[0] - break + menifest_info = war_zip.getinfo(menifest_fn) + retDict['buildDate'] = str(datetime.datetime(*menifest_info.date_time)) + return retDict