1#!/usr/bin/env python 2# 3# Copyright 2013 The Flutter Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6""" Parses manifest file and dumps it to json. 7""" 8 9import argparse 10import json 11import os 12import sys 13import hashlib 14 15 16def main(): 17 parser = argparse.ArgumentParser() 18 19 parser.add_argument( 20 '--input', dest='file_path', action='store', required=True) 21 22 args = parser.parse_args() 23 24 files = open(args.file_path, 'r') 25 lines = files.read().split() 26 27 output = {} 28 29 for line in lines: 30 key, val = line.strip().split('=') 31 md5 = hashlib.md5(key.encode()).hexdigest() 32 hash_key = 'md5_%s' % md5 33 # Uncomment this line to get the hash keys 34 # print val, hash_key 35 output[hash_key] = os.path.dirname(val) 36 37 print(json.dumps(output)) 38 39 return 0 40 41 42if __name__ == '__main__': 43 sys.exit(main()) 44