OLD | NEW |
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 | 75 |
75 config = source.read_config() | 76 config = source.read_config() |
76 defaultlocale = config.get("general", "defaultlocale") | 77 defaultlocale = config.get("general", "defaultlocale") |
77 locales = list(source.list_locales()) | 78 locales = list(source.list_locales()) |
78 if defaultlocale not in locales: | 79 if defaultlocale not in locales: |
79 locales.append(defaultlocale) | 80 locales.append(defaultlocale) |
80 | 81 |
81 # First pass: compile the list of pages with given translation level | 82 # First pass: compile the list of pages with given translation level |
82 pagelist = set() | 83 pagelist = set() |
83 blacklist = set() | 84 blacklist = set() |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 os.rmdir(path) | 138 os.rmdir(path) |
138 remove_unknown(output_dir) | 139 remove_unknown(output_dir) |
139 | 140 |
140 if __name__ == "__main__": | 141 if __name__ == "__main__": |
141 if len(sys.argv) < 3: | 142 if len(sys.argv) < 3: |
142 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] | 143 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] |
143 sys.exit(1) | 144 sys.exit(1) |
144 | 145 |
145 repo, output_dir = sys.argv[1:3] | 146 repo, output_dir = sys.argv[1:3] |
146 generate_pages(repo, output_dir) | 147 generate_pages(repo, output_dir) |
OLD | NEW |