Index: adblockplus/build.py |
=================================================================== |
--- a/adblockplus/build.py |
+++ b/adblockplus/build.py |
@@ -18,52 +18,56 @@ |
import os |
import shutil |
import subprocess |
import sys |
import tempfile |
_BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
-_ABP_DIR = "adblockplus" |
+_ABP_DIR = "adblockpluschrome" |
_ABP_CORE_DIR = "adblockpluscore" |
+_ABP_UI_DIR = "adblockplusui" |
+def _copy_subscriptions(xpi_path): |
+ xpi_dir = os.path.dirname(xpi_path) |
+ subscriptions_file = os.path.join(_BASE_DIR, _ABP_DIR, _ABP_UI_DIR, |
+ "subscriptions.xml") |
Thomas Greiner
2018/08/27 15:24:41
The canonical version of subscriptions.xml is loca
diegocarloslima
2018/08/27 21:19:16
Acknowledged.
|
+ shutil.copy2(subscriptions_file, xpi_dir) |
+ |
+ |
+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 _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) |
abp_dir = os.path.join(base_dir, _ABP_DIR) |
sys.path.insert(0, abp_dir) |
- import buildtools.build |
- import buildtools.packager |
+ 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") |
- buildtools.packager.getMetadataPath = get_metadata_path |
- buildtools.build.processArgs(abp_dir, ["", "build", 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")]) |
- |
- subprocess.check_call(["hg", "import", "-q", "-R", abp_core_dir, |
- os.path.join(patched_dir, "issue-6108.patch")]) |
+ tools_packager.getMetadataPath = get_metadata_path |
+ tools_build.process_args(abp_dir, "build", "-t", "gecko", "-r", xpi_path) |
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 |
try: |
+ _copy_subscriptions(xpi_path) |
_patch_abp(patched_dir) |
_build_abp(patched_dir, xpi_path) |
finally: |
shutil.rmtree(patched_dir) |