1#!/usr/bin/env python3 2# Copyright 2020 The Chromium Authors. All rights reserved. 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 7import argparse 8import sys 9 10from util import build_utils 11from util import resource_utils 12from util import resources_parser 13 14 15def 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 30if __name__ == '__main__': 31 sys.exit(main(sys.argv[1:])) 32