1#!/usr/bin/env python 2# 3# Copyright 2014 The Chromium 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 7"""Archives a set of files. 8""" 9 10import ast 11import optparse 12import os 13import sys 14 15sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'gyp')) 16from util import build_utils 17 18def main(): 19 parser = optparse.OptionParser() 20 build_utils.AddDepfileOption(parser) 21 22 parser.add_option('--inputs', help='List of files to archive.') 23 parser.add_option('--output', help='Path to output archive.') 24 parser.add_option('--base-dir', 25 help='If provided, the paths in the archive will be ' 26 'relative to this directory', default='.') 27 28 options, _ = parser.parse_args() 29 30 inputs = ast.literal_eval(options.inputs) 31 output = options.output 32 base_dir = options.base_dir 33 34 build_utils.DoZip(inputs, output, base_dir) 35 36 if options.depfile: 37 build_utils.WriteDepfile( 38 options.depfile, 39 build_utils.GetPythonDependencies()) 40 41 42if __name__ == '__main__': 43 sys.exit(main()) 44