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

Delta Between Two Patch Sets: adblockplus/build.py

Issue 6238034718621696: Issue 2483 - Give Adblock Browser its own app ID (Closed)
Left Patch Set: Address comments Created May 15, 2015, 10:06 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | adblockplus/issue-2509.patch » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 5 import shutil
6 import subprocess 6 import subprocess
7 import sys 7 import sys
8 import tempfile 8 import tempfile
9 9
10 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 10 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
Felix Dahlke 2015/05/15 22:09:08 Realised the naming here was inconsistent with our
11 ABP_DIR = os.path.join(BASE_DIR, "adblockplus") 11 ABP_DIR = os.path.join(BASE_DIR, "adblockplus")
12 12
13 def build_abp(base_dir, xpi_path): 13 def build_abp(base_dir, xpi_path):
14 xpi_dir = os.path.dirname(os.path.abspath(xpi_path)) 14 xpi_dir = os.path.dirname(os.path.abspath(xpi_path))
15 if not os.path.exists(xpi_dir): 15 if not os.path.exists(xpi_dir):
16 os.makedirs(xpi_dir) 16 os.makedirs(xpi_dir)
17 17
18 sys.path.insert(0, base_dir) 18 sys.path.insert(0, base_dir)
19 import buildtools.build 19 import buildtools.build
20 import buildtools.packager 20 import buildtools.packager
21 def get_metadata_path(base_dir, type): 21 def get_metadata_path(base_dir, type):
22 return os.path.join(BASE_DIR, "metadata.gecko") 22 return os.path.join(BASE_DIR, "metadata.gecko")
23 buildtools.packager.getMetadataPath = get_metadata_path 23 buildtools.packager.getMetadataPath = get_metadata_path
24 buildtools.build.processArgs(base_dir, ["", "build", xpi_path]) 24 buildtools.build.processArgs(base_dir, ["", "build", xpi_path])
25 25
26 if __name__ == "__main__": 26 if __name__ == "__main__":
27 if len(sys.argv) < 2: 27 if len(sys.argv) < 2:
28 print >>sys.stderr, "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
28 sys.exit(1) 29 sys.exit(1)
Wladimir Palant 2015/05/18 11:01:22 Exiting without an error message is strange, why d
Felix Dahlke 2015/05/18 19:43:28 Oops, forgot that one.
29 30
30 xpi_path = sys.argv[1] 31 xpi_path = sys.argv[1]
31 patched_abp_dir = tempfile.NamedTemporaryFile().name 32 patched_abp_dir = tempfile.NamedTemporaryFile().name
32 33
33 shutil.copytree(ABP_DIR, patched_abp_dir) 34 shutil.copytree(ABP_DIR, patched_abp_dir)
34 try: 35 try:
35 subprocess.call( 36 subprocess.check_call(["hg", "import", "-q", "-R",
36 ["hg", "import", "-q", os.path.join(BASE_DIR, "issue-2509.patch")], 37 os.path.join(patched_abp_dir, "buildtools"),
37 cwd=os.path.join(patched_abp_dir, "buildtools")) 38 os.path.join(BASE_DIR, "issue-2509.patch")]),
Wladimir Palant 2015/05/18 11:01:22 I'd prefer -R parameter instead of cwd but doesn't
Felix Dahlke 2015/05/18 19:43:28 Yeah that's nicer, done.
38 subprocess.call( 39 subprocess.check_call(["hg", "import", "-q", "-R", patched_abp_dir,
39 ["hg", "import", "-q", os.path.join(BASE_DIR, "issue-2510.patch")], 40 os.path.join(BASE_DIR, "issue-2510.patch")]),
40 cwd=patched_abp_dir)
41 build_abp(patched_abp_dir, xpi_path) 41 build_abp(patched_abp_dir, xpi_path)
42 finally: 42 finally:
43 shutil.rmtree(patched_abp_dir) 43 shutil.rmtree(patched_abp_dir)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld