Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | # This script creates a zip file, but will also strip any binaries |
michael@0 | 6 | # it finds before adding them to the zip. |
michael@0 | 7 | |
michael@0 | 8 | from mozpack.files import FileFinder |
michael@0 | 9 | from mozpack.copier import Jarrer |
michael@0 | 10 | from mozpack.errors import errors |
michael@0 | 11 | |
michael@0 | 12 | import argparse |
michael@0 | 13 | import buildconfig |
michael@0 | 14 | import mozpack.path as mozpath |
michael@0 | 15 | import os |
michael@0 | 16 | import sys |
michael@0 | 17 | import tempfile |
michael@0 | 18 | |
michael@0 | 19 | def main(args): |
michael@0 | 20 | parser = argparse.ArgumentParser() |
michael@0 | 21 | parser.add_argument("--base-dir", |
michael@0 | 22 | default=os.path.join(buildconfig.topobjdir, |
michael@0 | 23 | "dist", "bin"), |
michael@0 | 24 | help="Store paths relative to this directory") |
michael@0 | 25 | parser.add_argument("zip", help="Path to zip file to write") |
michael@0 | 26 | parser.add_argument("input", nargs="+", |
michael@0 | 27 | help="Path to files to add to zip") |
michael@0 | 28 | args = parser.parse_args(args) |
michael@0 | 29 | |
michael@0 | 30 | jarrer = Jarrer(optimize=False) |
michael@0 | 31 | |
michael@0 | 32 | with errors.accumulate(): |
michael@0 | 33 | finder = FileFinder(args.base_dir) |
michael@0 | 34 | for i in args.input: |
michael@0 | 35 | path = mozpath.relpath(i, args.base_dir) |
michael@0 | 36 | for p, f in finder.find(path): |
michael@0 | 37 | jarrer.add(p, f) |
michael@0 | 38 | jarrer.copy(args.zip) |
michael@0 | 39 | |
michael@0 | 40 | |
michael@0 | 41 | if __name__ == '__main__': |
michael@0 | 42 | main(sys.argv[1:]) |