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

Unified Diff: adblockplus/build.py

Issue 29347343: Issue 4278 - Update ABP for Firefox dependency to version 2.7.3 (Closed)
Patch Set: Created July 7, 2016, 6:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | adblockplus/issue-2509.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adblockplus/build.py
===================================================================
--- a/adblockplus/build.py
+++ b/adblockplus/build.py
@@ -1,43 +1,32 @@
#!/usr/bin/env python
# coding: utf-8
import os
-import shutil
-import subprocess
import sys
-import tempfile
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ABP_DIR = os.path.join(BASE_DIR, "adblockplus")
-def build_abp(base_dir, xpi_path):
- xpi_dir = os.path.dirname(os.path.abspath(xpi_path))
- if not os.path.exists(xpi_dir):
- os.makedirs(xpi_dir)
- sys.path.insert(0, base_dir)
- import buildtools.build
- import buildtools.packager
- def get_metadata_path(base_dir, type):
- return os.path.join(BASE_DIR, "metadata.gecko")
- buildtools.packager.getMetadataPath = get_metadata_path
- buildtools.build.processArgs(base_dir, ["", "build", xpi_path])
+def build_abp(xpi_path):
+ xpi_dir = os.path.dirname(os.path.abspath(xpi_path))
+ if not os.path.exists(xpi_dir):
+ os.makedirs(xpi_dir)
+
+ sys.path.insert(0, ABP_DIR)
+ import buildtools.build
+ import buildtools.packager
+
+ def get_metadata_path(base_dir, type):
+ return os.path.join(BASE_DIR, "metadata.gecko")
+ buildtools.packager.getMetadataPath = get_metadata_path
+ buildtools.build.processArgs(ABP_DIR, ["", "build", xpi_path])
if __name__ == "__main__":
- if len(sys.argv) < 2:
- print >>sys.stderr, "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
- sys.exit(1)
-
- xpi_path = sys.argv[1]
- patched_abp_dir = tempfile.NamedTemporaryFile().name
+ if len(sys.argv) < 2:
+ error_message = "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
+ print >>sys.stderr, error_message
+ sys.exit(1)
- shutil.copytree(ABP_DIR, patched_abp_dir)
- try:
- subprocess.check_call(["hg", "import", "-q", "-R",
- os.path.join(patched_abp_dir, "buildtools"),
- os.path.join(BASE_DIR, "issue-2509.patch")]),
- subprocess.check_call(["hg", "import", "-q", "-R", patched_abp_dir,
- os.path.join(BASE_DIR, "issue-2510.patch")]),
- build_abp(patched_abp_dir, xpi_path)
- finally:
- shutil.rmtree(patched_abp_dir)
+ xpi_path = sys.argv[1]
+ build_abp(xpi_path)
« 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