| OLD | NEW |
| 1 # This file is part of Adblock Plus | 1 # This file is part of Adblock Plus |
| 2 # Copyright (C) 2006-2015 Eyeo GmbH | 2 # Copyright (C) 2006-2015 Eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 engine_ids.append(line) | 159 engine_ids.append(line) |
| 160 else: | 160 else: |
| 161 removed_engine_ids.append(line) | 161 removed_engine_ids.append(line) |
| 162 | 162 |
| 163 # Make sure we still have search engines left | 163 # Make sure we still have search engines left |
| 164 if len(engine_ids) == 0: | 164 if len(engine_ids) == 0: |
| 165 logger.fatal("No search engines left over for '%s'" % locale) | 165 logger.fatal("No search engines left over for '%s'" % locale) |
| 166 | 166 |
| 167 # 'Parse' XML to get matching 'ShortName' for all engine IDs | 167 # 'Parse' XML to get matching 'ShortName' for all engine IDs |
| 168 engine_names = {} | 168 engine_names = {} |
| 169 for eid in engine_ids: | 169 for eid in engine_ids[:]: |
| 170 xml_file_path = os.path.join(path, _SEARCHPLUGINS_PATH, "%s.xml" % eid) | 170 xml_file_path = os.path.join(path, _SEARCHPLUGINS_PATH, "%s.xml" % eid) |
| 171 _check_path_exists(xml_file_path, logger) | 171 if not os.path.exists(xml_file_path): |
| 172 logger.info("Missing xml file for plugin %s" % eid) |
| 173 engine_ids.remove(eid) |
| 174 continue |
| 172 short_name = None | 175 short_name = None |
| 173 with open(xml_file_path, "r") as fd: | 176 with open(xml_file_path, "r") as fd: |
| 174 for line in fd: | 177 for line in fd: |
| 175 line = line.strip() | 178 line = line.strip() |
| 176 match = _SHORTNAME_RE.match(line) | 179 match = _SHORTNAME_RE.match(line) |
| 177 if match: | 180 if match: |
| 178 short_name = match.group(1).strip() | 181 short_name = match.group(1).strip() |
| 179 | 182 |
| 180 if not short_name: | 183 if not short_name: |
| 181 logger.fatal("No ShortName defined for '%s' in '%s" % | 184 logger.fatal("No ShortName defined for '%s' in '%s" % |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 locale_path = os.path.join(chrome_path, locale, "locale", locale) | 305 locale_path = os.path.join(chrome_path, locale, "locale", locale) |
| 303 if os.path.exists(locale_path): | 306 if os.path.exists(locale_path): |
| 304 _transform_locale(locale, locale_path, logger) | 307 _transform_locale(locale, locale_path, logger) |
| 305 else: | 308 else: |
| 306 logger.error("Missing folder for locale '%s' in path: %s" % | 309 logger.error("Missing folder for locale '%s' in path: %s" % |
| 307 (locale, locale_path)) | 310 (locale, locale_path)) |
| 308 | 311 |
| 309 for locale in values_locales: | 312 for locale in values_locales: |
| 310 locale_path = os.path.join(res_path, "values-" + locale) | 313 locale_path = os.path.join(res_path, "values-" + locale) |
| 311 _transform_values_locale(locale, locale_path, logger) | 314 _transform_values_locale(locale, locale_path, logger) |
| OLD | NEW |