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

Unified Diff: adblockplus/build.py

Issue 29863604: Issue 6865 - Update ABP dependency to version 3.2 (Closed)
Patch Set: Adjusting code style Created Jan. 16, 2019, 1:45 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/extensionBridge.js » ('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
@@ -17,53 +17,67 @@
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import subprocess
import sys
import tempfile
-_BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-_ABP_DIR = "adblockplus"
+_BASE_DIR_PATH = os.path.dirname(os.path.abspath(__file__))
+_ABP_DIR = "adblockpluschrome"
_ABP_CORE_DIR = "adblockpluscore"
+_SUBSCRIPTIONS_PATH = os.path.join(_BASE_DIR_PATH, _ABP_DIR, _ABP_CORE_DIR,
+ "chrome", "content", "ui",
+ "subscriptions.xml")
-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)
+def _import_issue_patch(src_path, patched_path, issue_name):
+ patch_filename = "issue-%s.patch" % issue_name
+ subprocess.check_call(["hg", "import", "-q", "-R", src_path,
+ os.path.join(patched_path, patch_filename)])
- abp_dir = os.path.join(base_dir, _ABP_DIR)
- sys.path.insert(0, abp_dir)
- import buildtools.build
- import buildtools.packager
+
+def _patch_abp(patched_path):
+ shutil.copytree(_BASE_DIR_PATH, patched_path)
+ abp_path = os.path.join(patched_path, _ABP_DIR)
+ abp_core_path = os.path.join(abp_path, _ABP_CORE_DIR)
+ _import_issue_patch(abp_core_path, patched_path, "6070")
+ _import_issue_patch(abp_path, patched_path, "6865")
+
+
+def _build_abp(base_path, xpi_path):
+ xpi_dir_path = os.path.dirname(xpi_path)
+ if not os.path.exists(xpi_dir_path):
+ os.makedirs(xpi_dir_path)
+
+ abp_dir_path = os.path.join(base_path, _ABP_DIR)
+ sys.path.insert(0, abp_dir_path)
+ import buildtools.build as tools_build
+ import buildtools.packager as tools_packager
def get_metadata_path(dir, type):
- return os.path.join(base_dir, "metadata.gecko")
+ return os.path.join(base_path, "metadata.gecko")
- buildtools.packager.getMetadataPath = get_metadata_path
- buildtools.build.processArgs(abp_dir, ["", "build", xpi_path])
+ tools_packager.getMetadataPath = get_metadata_path
+ tools_build.process_args(abp_dir_path, "build", "-t", "gecko", "-r",
+ xpi_path)
-def _patch_abp(patched_dir):
- shutil.copytree(_BASE_DIR, patched_dir)
- abp_dir = os.path.join(patched_dir, _ABP_DIR)
- abp_core_dir = os.path.join(abp_dir, _ABP_CORE_DIR)
- subprocess.check_call(["hg", "import", "-q", "-R", abp_core_dir,
- os.path.join(patched_dir, "issue-6070.patch")])
+def _copy_subscriptions(xpi_path):
+ xpi_dir_path = os.path.dirname(xpi_path)
+ shutil.copy2(_SUBSCRIPTIONS_PATH, xpi_dir_path)
- subprocess.check_call(["hg", "import", "-q", "-R", abp_core_dir,
- os.path.join(patched_dir, "issue-6108.patch")])
if __name__ == "__main__":
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)
- xpi_path = sys.argv[1]
- patched_dir = tempfile.NamedTemporaryFile().name
+ xpi_path = os.path.abspath(sys.argv[1])
+ patched_path = tempfile.NamedTemporaryFile().name
try:
- _patch_abp(patched_dir)
- _build_abp(patched_dir, xpi_path)
+ _patch_abp(patched_path)
+ _build_abp(patched_path, xpi_path)
+ _copy_subscriptions(xpi_path)
finally:
- shutil.rmtree(patched_dir)
+ shutil.rmtree(patched_path)
« no previous file with comments | « no previous file | adblockplus/extensionBridge.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld