| 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 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") |
| LEFT | RIGHT |