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.

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:])

mercurial