summaryrefslogtreecommitdiff
path: root/utils/create_xpi.py
blob: f2ad8a6bedf41bfc660f6e716c52604e5e1f093d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python2.7

# Uses the Python zip implementation to create deterministic XPI's
# Author: Yan Zhu, yan@mit.edu

"""
Usage: python create_xpi.py -n <name of zipped file> <directory>
"""

import argparse
import zipfile_deterministic as zipfile
import sys
import glob

parser = argparse.ArgumentParser(
    description="Deterministic XPI file creator.")
parser.add_argument("-n", type=str,
    dest="xpiname", help="Name of target XPI file.")
parser.add_argument("directory", type=str,
    help="Directory to compress.")

args = parser.parse_args()

compress = zipfile.ZIP_DEFLATED

xpiFile = zipfile.ZipFile(args.xpiname, mode='w', compression=compress)

xpiFile.write_from_directory(args.directory, [], compress_type=compress)
xpiFile.close()