Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: adblockplus/build.py

Issue 6238034718621696: Issue 2483 - Give Adblock Browser its own app ID (Closed)
Patch Set: Address additional comments Created May 18, 2015, 7:42 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | adblockplus/issue-2509.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 import os 4 import os
5 import shutil
6 import subprocess
5 import sys 7 import sys
8 import tempfile
6 9
7 import buildtools.build 10 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
8 import buildtools.packager 11 ABP_DIR = os.path.join(BASE_DIR, "adblockplus")
9 12
10 BUILD_DIR = os.path.dirname(os.path.abspath(__file__)) 13 def build_abp(base_dir, xpi_path):
11 BASE_DIR = os.path.join(BUILD_DIR, "adblockplus") 14 xpi_dir = os.path.dirname(os.path.abspath(xpi_path))
15 if not os.path.exists(xpi_dir):
16 os.makedirs(xpi_dir)
12 17
13 def getMetadataPath(baseDir, type): 18 sys.path.insert(0, base_dir)
14 return os.path.join(BUILD_DIR, "metadata.gecko") 19 import buildtools.build
20 import buildtools.packager
21 def get_metadata_path(base_dir, type):
22 return os.path.join(BASE_DIR, "metadata.gecko")
23 buildtools.packager.getMetadataPath = get_metadata_path
24 buildtools.build.processArgs(base_dir, ["", "build", xpi_path])
15 25
16 buildtools.packager.getMetadataPath = getMetadataPath 26 if __name__ == "__main__":
17 buildtools.build.processArgs(BASE_DIR, sys.argv) 27 if len(sys.argv) < 2:
28 print >>sys.stderr, "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
29 sys.exit(1)
30
31 xpi_path = sys.argv[1]
32 patched_abp_dir = tempfile.NamedTemporaryFile().name
33
34 shutil.copytree(ABP_DIR, patched_abp_dir)
35 try:
36 subprocess.check_call(["hg", "import", "-q", "-R",
37 os.path.join(patched_abp_dir, "buildtools"),
38 os.path.join(BASE_DIR, "issue-2509.patch")]),
39 subprocess.check_call(["hg", "import", "-q", "-R", patched_abp_dir,
40 os.path.join(BASE_DIR, "issue-2510.patch")]),
41 build_abp(patched_abp_dir, xpi_path)
42 finally:
43 shutil.rmtree(patched_abp_dir)
OLDNEW
« no previous file with comments | « no previous file | adblockplus/issue-2509.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld