aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-09 12:54:42 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-06-09 12:54:42 -0500
commit4dbba2dcabbde11b01a95078ba75742aff3fc44d (patch)
treea796241b1377d020af8da3c7d8ad20f465d2297b /python
parent0ac1ff066107def0781d18e1d76856380a349bef (diff)
parentdbef65129f40ce6ca0e8ee7e520ec366c1c7577e (diff)
downloadservo-4dbba2dcabbde11b01a95078ba75742aff3fc44d.tar.gz
servo-4dbba2dcabbde11b01a95078ba75742aff3fc44d.zip
Auto merge of #11513 - fduraffourg:pr11216, r=jdm
Add mach command to update public domain list and use a HashSet for matching <!-- Please describe your changes on the following line: --> Add a `mach update-pub-domains` command that update the public domain list used by servo. Replace the Vec matching with a HashSet which is way quicker. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11216 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11513) <!-- Reviewable:end -->
Diffstat (limited to 'python')
-rw-r--r--python/servo/bootstrap_commands.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py
index 659826fea66..373dc4ebbf0 100644
--- a/python/servo/bootstrap_commands.py
+++ b/python/servo/bootstrap_commands.py
@@ -299,6 +299,29 @@ class MachCommands(CommandBase):
print("Unable to parse chromium HSTS preload list, has the format changed?")
sys.exit(1)
+ @Command('update-pub-domains',
+ description='Download the public domains list and update resources/public_domains.txt',
+ category='bootstrap')
+ def bootstrap_pub_suffix(self, force=False):
+ list_url = "https://publicsuffix.org/list/public_suffix_list.dat"
+ dst_filename = path.join(self.context.topdir, "resources", "public_domains.txt")
+ not_implemented_case = re.compile(r'^[^*]+\*')
+
+ try:
+ content = download_bytes("Public suffix list", list_url)
+ except urllib2.URLError:
+ print("Unable to download the public suffix list; are you connected to the internet?")
+ sys.exit(1)
+
+ lines = [l.strip() for l in content.decode("utf8").split("\n")]
+ suffixes = [l for l in lines if not l.startswith("//") and not l == ""]
+
+ with open(dst_filename, "wb") as fo:
+ for suffix in suffixes:
+ if not_implemented_case.match(suffix):
+ print("Warning: the new list contains a case that servo can't handle: %s" % suffix)
+ fo.write(suffix.encode("idna") + "\n")
+
@Command('clean-nightlies',
description='Clean unused nightly builds of Rust and Cargo',
category='bootstrap')