| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 _update_abp2blocklist() | 74 _update_abp2blocklist() |
| 75 | 75 |
| 76 print "Downloading filter lists ..." | 76 print "Downloading filter lists ..." |
| 77 easylist_file, exceptionrules_file = _download_filter_lists() | 77 easylist_file, exceptionrules_file = _download_filter_lists() |
| 78 | 78 |
| 79 try: | 79 try: |
| 80 print "Generating %s ..." % os.path.basename(EASYLIST_CONTENT_BLOCKER_PATH) | 80 print "Generating %s ..." % os.path.basename(EASYLIST_CONTENT_BLOCKER_PATH) |
| 81 _convert_filter_list(easylist_file, EASYLIST_CONTENT_BLOCKER_PATH) | 81 _convert_filter_list(easylist_file, EASYLIST_CONTENT_BLOCKER_PATH) |
| 82 | 82 |
| 83 print "Generating %s ..." % os.path.basename(COMBINED_CONTENT_BLOCKER_PATH) | 83 print "Generating %s ..." % os.path.basename(COMBINED_CONTENT_BLOCKER_PATH) |
| 84 combined_file = _concatenate_files(easylist_file, exceptionrules_file) | 84 with _concatenate_files(easylist_file, exceptionrules_file) as combined_file : |
|
Sebastian Noack
2015/10/22 02:55:06
With statement?
Felix Dahlke
2015/10/22 03:16:46
Good catch, couldn't use it above (not without int
| |
| 85 try: | |
| 86 _convert_filter_list(combined_file, COMBINED_CONTENT_BLOCKER_PATH) | 85 _convert_filter_list(combined_file, COMBINED_CONTENT_BLOCKER_PATH) |
| 87 finally: | |
| 88 combined_file.close() | |
| 89 finally: | 86 finally: |
| 90 easylist_file.close() | 87 easylist_file.close() |
| 91 exceptionrules_file.close() | 88 exceptionrules_file.close() |
| LEFT | RIGHT |