diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-10-11 14:42:24 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-10-11 14:42:24 +0200 |
commit | ebcf0a907b22ffcb26be6a6756e7882e63293cdb (patch) | |
tree | f8e121bd7b54a1688dd45d1b550a65bde7bcdce2 /esc-reporting | |
parent | 9f60bf87a757e6a50aa92f21e3ea3a8f05c9592c (diff) |
ESC: read gzip files correctly
Diffstat (limited to 'esc-reporting')
-rwxr-xr-x | esc-reporting/esc-analyze.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py index bdfcf74c..5bf0848d 100755 --- a/esc-reporting/esc-analyze.py +++ b/esc-reporting/esc-analyze.py @@ -959,13 +959,17 @@ def runAnalyze(): global cfg, statList global openhubData, bugzillaData, bugzillaESCData, gerritData, gitData, crashData, weekList, automateData, committersNames + weekList = None x = (cfg['nowDate'] - datetime.timedelta(days=7)).strftime('%Y-%m-%d') - jsonFileName = 'stats_' + x + '.json' - gzFilePath = cfg['homedir'] + 'archive/' + jsonFileName + '.gz' + gzFilePath = cfg['homedir'] + 'archive/stats_' + x + '.json.gz' if os.path.isfile(gzFilePath): - with gzip.open(gzFilePath , 'rb'): - weekList = util_load_file(jsonFileName) - else: + fp = gzip.open(gzFilePath) + content = fp.read() + fp.close() + if content: + weekList = json.loads(content.decode('utf-8')) + + if not weekList: weekList = util_create_statList() openhubData = util_load_data_file(cfg['homedir'] + 'dump/openhub_dump.json') |