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

Unified Diff: adblockplus/build.py

Issue 6238034718621696: Issue 2483 - Give Adblock Browser its own app ID (Closed)
Patch Set: Created May 14, 2015, 3:21 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') | mobile/android/build.mk » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adblockplus/build.py
===================================================================
--- a/adblockplus/build.py
+++ b/adblockplus/build.py
@@ -2,16 +2,39 @@
# coding: utf-8
import os
+import shutil
import sys
-import buildtools.build
-import buildtools.packager
-
BUILD_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.join(BUILD_DIR, "adblockplus")
-def getMetadataPath(baseDir, type):
- return os.path.join(BUILD_DIR, "metadata.gecko")
+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.mkdir(xpi_dir)
Wladimir Palant 2015/05/15 19:16:16 os.makedirs() please - you don't know whether its
Felix Dahlke 2015/05/15 22:09:08 Done.
-buildtools.packager.getMetadataPath = getMetadataPath
-buildtools.build.processArgs(BASE_DIR, sys.argv)
+ sys.path.insert(0, base_dir)
+ import buildtools.build
+ import buildtools.packager
+ def get_metadata_path(base_dir, type):
+ return os.path.join(BUILD_DIR, "metadata.gecko")
+ buildtools.packager.getMetadataPath = get_metadata_path
Wladimir Palant 2015/05/15 19:16:16 Funny how you replace getMetadataPath yet use a pa
Felix Dahlke 2015/05/15 22:09:08 Sticking to applying the issue 2509 patch file as
+ buildtools.build.processArgs(base_dir, ["", "build", xpi_path])
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print "Usage: %s XPI_PATH" % os.path.basename(sys.argv[0])
+ sys.exit(1)
+
+ xpi_path = sys.argv[1]
+ patched_base_dir = os.path.join(os.sep, "tmp",
+ "adblockplus-patched-%s" % os.getpid())
Wladimir Palant 2015/05/15 19:16:16 Please use tempfile.mkdtemp(), even though Windows
Felix Dahlke 2015/05/15 22:09:08 Forgot about tempfile, much nicer indeed. Ended up
+ shutil.copytree(BASE_DIR, patched_base_dir)
+ try:
+ os.system('patch -s -p1 -d "%s/buildtools" < "%s/issue-2509.patch"' % (
+ patched_base_dir, BUILD_DIR))
+ os.system('patch -s -p1 -d "%s" < "%s/issue-2510.patch"' % (
+ patched_base_dir, BUILD_DIR))
Wladimir Palant 2015/05/15 19:16:16 1) Call hg import maybe? 2) Please use subprocess.
Felix Dahlke 2015/05/15 22:09:08 Done.
+ build_abp(patched_base_dir, xpi_path)
+ finally:
+ shutil.rmtree(patched_base_dir)
« no previous file with comments | « no previous file | adblockplus/issue-2509.patch » ('j') | mobile/android/build.mk » ('J')

Powered by Google App Engine
This is Rietveld