| LEFT | RIGHT |
| (no file at all) | |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 handle.write(contents) | 64 handle.write(contents) |
| 65 | 65 |
| 66 with MercurialSource(repo) as source: | 66 with MercurialSource(repo) as source: |
| 67 # Cache the result for some functions - we can assume here that the data | 67 # Cache the result for some functions - we can assume here that the data |
| 68 # never changes | 68 # never changes |
| 69 source.resolve_link = memoize(source.resolve_link) | 69 source.resolve_link = memoize(source.resolve_link) |
| 70 source.read_config = memoize(source.read_config) | 70 source.read_config = memoize(source.read_config) |
| 71 source.read_template = memoize(source.read_template) | 71 source.read_template = memoize(source.read_template) |
| 72 source.read_locale = memoize(source.read_locale) | 72 source.read_locale = memoize(source.read_locale) |
| 73 source.read_include = memoize(source.read_include) | 73 source.read_include = memoize(source.read_include) |
| 74 source.import_symbol = memoize(source.import_symbol) | 74 source.exec_file = memoize(source.exec_file) |
| 75 | 75 |
| 76 config = source.read_config() | 76 config = source.read_config() |
| 77 defaultlocale = config.get("general", "defaultlocale") | 77 defaultlocale = config.get("general", "defaultlocale") |
| 78 locales = list(source.list_locales()) | 78 locales = list(source.list_locales()) |
| 79 if defaultlocale not in locales: | 79 if defaultlocale not in locales: |
| 80 locales.append(defaultlocale) | 80 locales.append(defaultlocale) |
| 81 | 81 |
| 82 # First pass: compile the list of pages with given translation level | 82 # First pass: compile the list of pages with given translation level |
| 83 def get_locale_file(page): | 83 def get_locale_file(page): |
| 84 try: | 84 try: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 os.rmdir(path) | 141 os.rmdir(path) |
| 142 remove_unknown(output_dir) | 142 remove_unknown(output_dir) |
| 143 | 143 |
| 144 if __name__ == "__main__": | 144 if __name__ == "__main__": |
| 145 if len(sys.argv) < 3: | 145 if len(sys.argv) < 3: |
| 146 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] | 146 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] |
| 147 sys.exit(1) | 147 sys.exit(1) |
| 148 | 148 |
| 149 repo, output_dir = sys.argv[1:3] | 149 repo, output_dir = sys.argv[1:3] |
| 150 generate_pages(repo, output_dir) | 150 generate_pages(repo, output_dir) |
| LEFT | RIGHT |