2 # Copyright (c) 2008 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.
6 """A simple utility function to merge data pack files into a single data pack.
7 See base/pack_file* for details about the file format.
16 def RePack(output_file
, input_files
):
17 """Write a new data pack to |output_file| based on a list of filenames
20 for filename
in input_files
:
21 new_resources
= data_pack
.ReadDataPack(filename
)
23 # Make sure we have no dups.
24 duplicate_keys
= set(new_resources
.keys()) & set(resources
.keys())
25 if len(duplicate_keys
) != 0:
26 raise exceptions
.KeyError("Duplicate keys: " + str(list(duplicate_keys
)))
28 resources
.update(new_resources
)
30 data_pack
.WriteDataPack(resources
, output_file
)
34 print ("Usage:\n %s <output_filename> <input_file1> [input_file2] ... " %
37 RePack(argv
[1], argv
[2:])
39 if '__main__' == __name__
: