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 comments Created May 15, 2015, 10:06 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__))
Felix Dahlke 2015/05/15 22:09:08 Realised the naming here was inconsistent with our
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 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 xpi_path = sys.argv[1]
31 patched_abp_dir = tempfile.NamedTemporaryFile().name
32
33 shutil.copytree(ABP_DIR, patched_abp_dir)
34 try:
35 subprocess.call(
36 ["hg", "import", "-q", os.path.join(BASE_DIR, "issue-2509.patch")],
37 cwd=os.path.join(patched_abp_dir, "buildtools"))
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 ["hg", "import", "-q", os.path.join(BASE_DIR, "issue-2510.patch")],
40 cwd=patched_abp_dir)
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