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

Delta Between Two Patch Sets: sitescripts/content_blocker_lists/bin/generate_lists.py

Issue 29329537: Issue 3168 - Add a script for generating content blocker lists (Closed)
Left Patch Set: Remove _get_config_value, combine lists in _convert_filter_lists Created Nov. 19, 2015, 11:13 a.m.
Right Patch Set: Remove retcode variable, move return code check out of the with block Created Nov. 20, 2015, 7 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/content_blocker_lists/bin/__init__.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 # This file is part of Adblock Plus <https://adblockplus.org/>, 4 # This file is part of Adblock Plus <https://adblockplus.org/>,
5 # Copyright (C) 2006-2015 Eyeo GmbH 5 # Copyright (C) 2006-2015 Eyeo GmbH
6 # 6 #
7 # Adblock Plus is free software: you can redistribute it and/or modify 7 # Adblock Plus is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 3 as 8 # it under the terms of the GNU General Public License version 3 as
9 # published by the Free Software Foundation. 9 # published by the Free Software Foundation.
10 # 10 #
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 abp2blocklist_path = config.get("content_blocker_lists", 53 abp2blocklist_path = config.get("content_blocker_lists",
54 "abp2blocklist_path") 54 "abp2blocklist_path")
55 process = subprocess.Popen(("node", "abp2blocklist.js"), 55 process = subprocess.Popen(("node", "abp2blocklist.js"),
56 cwd=abp2blocklist_path, stdin=subprocess.PIPE, 56 cwd=abp2blocklist_path, stdin=subprocess.PIPE,
57 stdout=destination_file) 57 stdout=destination_file)
58 try: 58 try:
59 for source in sources: 59 for source in sources:
60 print >>process.stdin, source 60 print >>process.stdin, source
61 finally: 61 finally:
62 process.stdin.close() 62 process.stdin.close()
63 if process.wait(): 63 process.wait()
Felix Dahlke 2015/11/19 11:15:20 Do you think this is too obscure?
Sebastian Noack 2015/11/19 20:08:34 This ... 1. Introduces an unnecessary level of in
Felix Dahlke 2015/11/19 20:48:43 Done.
64 raise Exception("abp2blocklist returned %s" % process.returncode) 64
65 if process.returncode:
66 raise Exception("abp2blocklist returned %s" % process.returncode)
65 67
66 if __name__ == "__main__": 68 if __name__ == "__main__":
67 _update_abp2blocklist() 69 _update_abp2blocklist()
68 70
69 easylist = _download("easylist_url") 71 easylist = _download("easylist_url")
70 exceptionrules = _download("exceptionrules_url") 72 exceptionrules = _download("exceptionrules_url")
71 73
72 _convert_filter_list([easylist], "easylist_content_blocker_path") 74 _convert_filter_list([easylist], "easylist_content_blocker_path")
73 _convert_filter_list([easylist, exceptionrules], 75 _convert_filter_list([easylist, exceptionrules],
74 "combined_content_blocker_path") 76 "combined_content_blocker_path")
LEFTRIGHT

Powered by Google App Engine
This is Rietveld