LEFT | RIGHT |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-2014 Eyeo GmbH | 2 # Copyright (C) 2006-2014 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 @property | 57 @property |
58 def release_date(self): | 58 def release_date(self): |
59 command = ['hg', 'log', '-l', '1', self.download_filename, '--template', '{d
ate}'] | 59 command = ['hg', 'log', '-l', '1', self.download_filename, '--template', '{d
ate}'] |
60 result = subprocess.check_output(command, cwd=self.repo.downloadsRepo) | 60 result = subprocess.check_output(command, cwd=self.repo.downloadsRepo) |
61 timestamp, offset = re.match(r'(.*)([-+].*)', result).groups() | 61 timestamp, offset = re.match(r'(.*)([-+].*)', result).groups() |
62 return datetime(*time.gmtime(float(timestamp) + float(offset))[:6]) | 62 return datetime(*time.gmtime(float(timestamp) + float(offset))[:6]) |
63 | 63 |
64 @property | 64 @property |
65 def download_size(self): | 65 def download_size(self): |
66 return len(subprocess.check_output( | 66 return len(subprocess.check_output( |
67 ['hg', 'cat', self.download_filename], | 67 ['hg', 'cat', '-r', 'tip', self.download_filename], |
68 cwd=self.repo.downloadsRepo | 68 cwd=self.repo.downloadsRepo |
69 )) | 69 )) |
70 | 70 |
71 @property | 71 @property |
72 def browser_min_version(self): | 72 def browser_min_version(self): |
73 metadata = self.repo.readMetadata(self.version) | 73 metadata = self.repo.readMetadata(self.version) |
74 compat_option = getattr(self, 'compat_option', self.repo.type) | 74 compat_option = getattr(self, 'compat_option', self.repo.type) |
75 return metadata.get('compat', compat_option).split('/')[0].rstrip('.0') | 75 return metadata.get('compat', compat_option).split('/')[0].rstrip('.0') |
76 | 76 |
77 @property | 77 @property |
(...skipping 21 matching lines...) Expand all Loading... |
99 if groups.get('skip') is not None: | 99 if groups.get('skip') is not None: |
100 skipped.add(code) | 100 skipped.add(code) |
101 continue | 101 continue |
102 | 102 |
103 languages.add(code) | 103 languages.add(code) |
104 | 104 |
105 return iso2pad(languages.difference(skipped)) | 105 return iso2pad(languages.difference(skipped)) |
106 | 106 |
107 def write(self): | 107 def write(self): |
108 template = get_template(self.repo.padTemplate) | 108 template = get_template(self.repo.padTemplate) |
109 filename = self.repo.basename + '.xml' | 109 basename = self.repo.basename |
| 110 filename = basename + '.xml' |
110 | 111 |
111 pad = template.render({ | 112 pad = template.render({ |
| 113 'name': self.repo.name, |
112 'type': self.repo.type, | 114 'type': self.repo.type, |
| 115 'basename': basename, |
113 'browser_name': self.browser_name, | 116 'browser_name': self.browser_name, |
114 'browser_min_version': self.browser_min_version, | 117 'browser_min_version': self.browser_min_version, |
115 'version': self.version, | 118 'version': self.version, |
116 'release_date': self.release_date, | 119 'release_date': self.release_date, |
117 'release_status': self.release_status, | 120 'release_status': self.release_status, |
118 'os_support': ','.join(self.os_support), | 121 'os_support': ','.join(self.os_support), |
119 'language': ','.join(self.languages), | 122 'language': ','.join(self.languages), |
120 'download_size': self.download_size, | 123 'download_size': self.download_size, |
121 'download_url': self.download_url, | 124 'download_url': self.download_url, |
122 'pad_url': urljoin(self.repo.padURL, filename), | 125 'pad_url': urljoin(self.repo.padURL, filename), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 os_support = OS_WINDOWS + OS_MAC + OS_LINUX | 159 os_support = OS_WINDOWS + OS_MAC + OS_LINUX |
157 translation_files_regex = r'_locales\/(?P<code>.+?)\/' | 160 translation_files_regex = r'_locales\/(?P<code>.+?)\/' |
158 | 161 |
159 class OperaPadFile(PadFile): | 162 class OperaPadFile(PadFile): |
160 browser_name = 'Opera' | 163 browser_name = 'Opera' |
161 browser_min_version = '17' | 164 browser_min_version = '17' |
162 os_support = OS_WINDOWS + OS_MAC + OS_LINUX | 165 os_support = OS_WINDOWS + OS_MAC + OS_LINUX |
163 translation_files_regex = ChromePadFile.translation_files_regex | 166 translation_files_regex = ChromePadFile.translation_files_regex |
164 | 167 |
165 class SafariPadFile(PadFile): | 168 class SafariPadFile(PadFile): |
166 borwser_name = 'Safari' | 169 browser_name = 'Safari' |
167 browser_min_version = '6' | 170 browser_min_version = '6' |
168 os_support = OS_MAC | 171 os_support = OS_MAC |
169 translation_files_regex = ChromePadFile.translation_files_regex | 172 translation_files_regex = ChromePadFile.translation_files_regex |
170 | 173 |
171 class InternetExplorerPadFile(PadFile): | 174 class InternetExplorerPadFile(PadFile): |
172 browser_name = 'Internet Explorer' | 175 browser_name = 'Internet Explorer' |
173 browser_min_version = '8' | 176 browser_min_version = '8' |
174 os_support = OS_WINDOWS | 177 os_support = OS_WINDOWS |
175 translation_files_regex = r'locales\/(?P<code>.+)\.ini$' | 178 translation_files_regex = r'locales\/(?P<code>.+)\.ini$' |
176 | 179 |
177 class AndroidPadFile(PadFile): | 180 class AndroidPadFile(PadFile): |
178 browser_name = 'Android' | 181 browser_name = 'Android' |
179 os_support = OS_ANDROID | 182 os_support = OS_ANDROID |
180 translation_files_regex = r'res\/(?:raw|values)(?:-(?P<code>.+?)|(?P<is_en>))\
/' | 183 translation_files_regex = r'res\/(?:raw|values)(?:-(?P<code>.+?)|(?P<is_en>))\
/' |
181 | 184 |
182 @property | 185 @property |
183 def browser_min_version(self): | 186 def browser_min_version(self): |
184 return get_min_android_version(self.repo, self.version) | 187 return get_min_android_version(self.repo, self.version) |
LEFT | RIGHT |