toolkit/mozapps/installer/dozip.py

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial