toolkit/mozapps/installer/dozip.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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