create_r_txt.py (1044B)
1 #!/usr/bin/env python3 2 # Copyright 2020 The Chromium Authors 3 # Use of this source code is governed by a BSD-style license that can be 4 # found in the LICENSE file. 5 """Writes a dummy R.txt file from a resource zip.""" 6 7 import argparse 8 import sys 9 10 from util import build_utils 11 from util import resource_utils 12 from util import resources_parser 13 14 15 def main(args): 16 parser = argparse.ArgumentParser( 17 description='Create an R.txt from resources.') 18 parser.add_argument('--resources-zip-path', 19 required=True, 20 help='Path to input resources zip.') 21 parser.add_argument('--rtxt-path', 22 required=True, 23 help='Path to output R.txt file.') 24 options = parser.parse_args(build_utils.ExpandFileArgs(args)) 25 with build_utils.TempDir() as temp: 26 dep_subdirs = resource_utils.ExtractDeps([options.resources_zip_path], temp) 27 resources_parser.RTxtGenerator(dep_subdirs).WriteRTxtFile(options.rtxt_path) 28 29 30 if __name__ == '__main__': 31 sys.exit(main(sys.argv[1:]))