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

Side by Side Diff: adblockplus/build.py

Issue 29626577: Issue 6108 - No filter list is selected after a migration failure (Closed)
Patch Set: Created Dec. 1, 2017, 8:24 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
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 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__))
11 _ABP_DIR = "adblockplus" 11 _ABP_DIR = "adblockplus"
12 _ABP_CORE_DIR = "adblockpluscore"
12 13
13 14
14 def _build_abp(base_dir, xpi_path): 15 def _build_abp(base_dir, xpi_path):
15 xpi_dir = os.path.dirname(os.path.abspath(xpi_path)) 16 xpi_dir = os.path.dirname(os.path.abspath(xpi_path))
16 if not os.path.exists(xpi_dir): 17 if not os.path.exists(xpi_dir):
17 os.makedirs(xpi_dir) 18 os.makedirs(xpi_dir)
18 19
19 abp_dir = os.path.join(base_dir, _ABP_DIR) 20 abp_dir = os.path.join(base_dir, _ABP_DIR)
20 sys.path.insert(0, abp_dir) 21 sys.path.insert(0, abp_dir)
21 import buildtools.build 22 import buildtools.build
22 import buildtools.packager 23 import buildtools.packager
23 24
24 def get_metadata_path(dir, type): 25 def get_metadata_path(dir, type):
25 return os.path.join(base_dir, "metadata.gecko") 26 return os.path.join(base_dir, "metadata.gecko")
26 27
27 buildtools.packager.getMetadataPath = get_metadata_path 28 buildtools.packager.getMetadataPath = get_metadata_path
28 buildtools.build.processArgs(abp_dir, ["", "build", xpi_path]) 29 buildtools.build.processArgs(abp_dir, ["", "build", xpi_path])
29 30
30 31
31 def _patch_abp(patched_dir): 32 def _patch_abp(patched_dir):
32 shutil.copytree(_BASE_DIR, patched_dir) 33 shutil.copytree(_BASE_DIR, patched_dir)
33 abp_dir = os.path.join(patched_dir, _ABP_DIR) 34 abp_dir = os.path.join(patched_dir, _ABP_DIR)
34 subprocess.check_call(["hg", "import", "-q", "-R", 35 abp_core_dir = os.path.join(abp_dir, _ABP_CORE_DIR)
35 os.path.join(abp_dir, "adblockpluscore"), 36 subprocess.check_call(["hg", "import", "-q", "-R", abp_core_dir,
36 os.path.join(patched_dir, "issue-6070.patch")]) 37 os.path.join(patched_dir, "issue-6070.patch")])
37 38
39 subprocess.check_call(["hg", "import", "-q", "-R", abp_core_dir,
40 os.path.join(patched_dir, "issue-6108.patch")])
41
38 if __name__ == "__main__": 42 if __name__ == "__main__":
39 if len(sys.argv) < 2: 43 if len(sys.argv) < 2:
40 error_message = "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0]) 44 error_message = "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
41 print >>sys.stderr, error_message 45 print >>sys.stderr, error_message
42 sys.exit(1) 46 sys.exit(1)
43 47
44 xpi_path = sys.argv[1] 48 xpi_path = sys.argv[1]
45 patched_dir = tempfile.NamedTemporaryFile().name 49 patched_dir = tempfile.NamedTemporaryFile().name
46 try: 50 try:
47 _patch_abp(patched_dir) 51 _patch_abp(patched_dir)
48 _build_abp(patched_dir, xpi_path) 52 _build_abp(patched_dir, xpi_path)
49 finally: 53 finally:
50 shutil.rmtree(patched_dir) 54 shutil.rmtree(patched_dir)
OLDNEW
« adblockplus/Api.jsm ('K') | « adblockplus/Api.jsm ('k') | adblockplus/issue-6108.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld