Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 retcode = process.wait() | 63 process.wait() |
64 | 64 |
65 if retcode: | 65 if process.returncode: |
Sebastian Noack
2015/11/20 00:03:47
You can move that out of the with block as well. A
Felix Dahlke
2015/11/20 07:00:55
Done.
| |
66 raise Exception("abp2blocklist returned %s" % retcode) | 66 raise Exception("abp2blocklist returned %s" % process.returncode) |
67 | 67 |
68 if __name__ == "__main__": | 68 if __name__ == "__main__": |
69 _update_abp2blocklist() | 69 _update_abp2blocklist() |
70 | 70 |
71 easylist = _download("easylist_url") | 71 easylist = _download("easylist_url") |
72 exceptionrules = _download("exceptionrules_url") | 72 exceptionrules = _download("exceptionrules_url") |
73 | 73 |
74 _convert_filter_list([easylist], "easylist_content_blocker_path") | 74 _convert_filter_list([easylist], "easylist_content_blocker_path") |
75 _convert_filter_list([easylist, exceptionrules], | 75 _convert_filter_list([easylist, exceptionrules], |
76 "combined_content_blocker_path") | 76 "combined_content_blocker_path") |
LEFT | RIGHT |