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-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 resetMatches(rules) | 143 resetMatches(rules) |
144 | 144 |
145 result = result.keys() | 145 result = result.keys() |
146 result.sort() | 146 result.sort() |
147 return result | 147 return result |
148 | 148 |
149 @cached(600) | 149 @cached(600) |
150 def getRules(): | 150 def getRules(): |
151 repoPath = os.path.abspath(get_config().get('subscriptions', 'repository')) | 151 repoPath = os.path.abspath(get_config().get('subscriptions', 'repository')) |
152 | 152 |
153 data = subprocess.check_output(['hg', '-q', '-R', repoPath, 'cat', '-r', 'defa
ult', os.path.join(repoPath, 'knownIssues')]) | 153 data = subprocess.check_output(['hg', '-R', repoPath, 'cat', '-r', 'default',
os.path.join(repoPath, 'knownIssues')]) |
154 data = data.decode('utf-8').replace('\r', '').split('\n') | 154 data = data.decode('utf-8').replace('\r', '').split('\n') |
155 data.append('[]') # Pushes out last section | 155 data.append('[]') # Pushes out last section |
156 | 156 |
157 rules = {} | 157 rules = {} |
158 rulesets = [] | 158 rulesets = [] |
159 | 159 |
160 ruleset = None | 160 ruleset = None |
161 for line in data: | 161 for line in data: |
162 commentIndex = line.find('#') | 162 commentIndex = line.find('#') |
163 if commentIndex >= 0: | 163 if commentIndex >= 0: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 continue | 223 continue |
224 | 224 |
225 value = ' '.join(foundAttrs) | 225 value = ' '.join(foundAttrs) |
226 if requiredValue != None: | 226 if requiredValue != None: |
227 if requiredValue != value: | 227 if requiredValue != value: |
228 continue | 228 continue |
229 value = text | 229 value = text |
230 | 230 |
231 checkMatch(rules, key, value) | 231 checkMatch(rules, key, value) |
232 return extractMatches(rules, rulesets, lang) | 232 return extractMatches(rules, rulesets, lang) |
OLD | NEW |