Left: | ||
Right: |
OLD | NEW |
---|---|
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) | |
OLD | NEW |