| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 os.makedirs(baseDir) | 193 os.makedirs(baseDir) |
| 194 if self.config.type == 'chrome' or self.config.type == 'opera': | 194 if self.config.type == 'chrome' or self.config.type == 'opera': |
| 195 manifestPath = os.path.join(baseDir, "updates.xml") | 195 manifestPath = os.path.join(baseDir, "updates.xml") |
| 196 templateName = 'chromeUpdateManifest' | 196 templateName = 'chromeUpdateManifest' |
| 197 elif self.config.type == 'safari': | 197 elif self.config.type == 'safari': |
| 198 manifestPath = os.path.join(baseDir, "updates.plist") | 198 manifestPath = os.path.join(baseDir, "updates.plist") |
| 199 templateName = 'safariUpdateManifest' | 199 templateName = 'safariUpdateManifest' |
| 200 elif self.config.type == 'android': | 200 elif self.config.type == 'android': |
| 201 manifestPath = os.path.join(baseDir, "updates.xml") | 201 manifestPath = os.path.join(baseDir, "updates.xml") |
| 202 templateName = 'androidUpdateManifest' | 202 templateName = 'androidUpdateManifest' |
| 203 elif self.config.type == 'ie': | |
| 204 manifestPath = os.path.join(baseDir, "update.json") | |
| 205 templateName = 'ieUpdateManifest' | |
|
Wladimir Palant
2014/07/29 11:25:18
libabpUpdateManifest please, this format isn't spe
Felix Dahlke
2014/07/29 11:37:17
As it is, the update manifest is IE specific, we w
| |
| 206 else: | 203 else: |
| 207 manifestPath = os.path.join(baseDir, "update.rdf") | 204 manifestPath = os.path.join(baseDir, "update.rdf") |
| 208 templateName = 'geckoUpdateManifest' | 205 templateName = 'geckoUpdateManifest' |
| 209 | 206 |
| 210 template = get_template(get_config().get('extensions', templateName)) | 207 template = get_template(get_config().get('extensions', templateName)) |
| 211 template.stream({'extensions': [self]}).dump(manifestPath) | 208 template.stream({'extensions': [self]}).dump(manifestPath) |
| 212 | 209 |
| 213 def writeIEUpdateManifest(self, versions): | 210 def writeIEUpdateManifest(self, versions): |
| 214 """ | 211 """ |
| 215 Writes update.json file for the latest IE build | 212 Writes update.json file for the latest IE build |
| 216 """ | 213 """ |
| 217 if len(versions) == 0: | 214 if len(versions) == 0: |
| 218 return | 215 return |
| 219 | 216 |
| 217 version = versions[0] | |
| 218 packageName = self.basename + '-' + version + self.config.packageSuffix | |
| 219 updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + '/' + packageName + '?update') | |
| 220 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 220 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) |
| 221 if not os.path.exists(baseDir): | 221 manifestPath = os.path.join(baseDir, 'update.json') |
| 222 os.makedirs(baseDir) | 222 |
| 223 | 223 from sitescripts.extensions.utils import writeIEUpdateManifest as doWrite |
| 224 self.version = versions[0] | 224 doWrite(manifestPath, [{ |
|
Wladimir Palant
2014/07/29 11:25:18
This function shouldn't set any instance variables
Felix Dahlke
2014/07/29 11:37:17
True, it's a hack. How about I move this part to w
Wladimir Palant
2014/07/29 12:03:10
Yes, that would make sense.
| |
| 225 packageName = self.basename + '-' + self.version + self.config.packageSuffix | 225 'basename': self.basename, |
| 226 self.updateURL = urlparse.urljoin(self.config.nightliesURL, self.basename + | 226 'version': version, |
| 227 '/' + packageName + '?update') | 227 'updateURL': updateURL |
| 228 self.name = self.basename | 228 }]) |
| 229 self.writeUpdateManifest() | |
| 230 | 229 |
| 231 for suffix in (self.config.packageSuffix, self.config.packageSuffix.replace( "-x64", "-x86")): | 230 for suffix in (self.config.packageSuffix, self.config.packageSuffix.replace( "-x64", "-x86")): |
| 232 linkPath = os.path.join(baseDir, '00latest%s' % suffix) | 231 linkPath = os.path.join(baseDir, '00latest%s' % suffix) |
| 233 outputPath = os.path.join(baseDir, self.basename + '-' + self.version + su ffix) | 232 outputPath = os.path.join(baseDir, self.basename + '-' + version + suffix) |
| 234 if hasattr(os, 'symlink'): | 233 if hasattr(os, 'symlink'): |
| 235 if os.path.exists(linkPath): | 234 if os.path.exists(linkPath): |
| 236 os.remove(linkPath) | 235 os.remove(linkPath) |
| 237 os.symlink(os.path.basename(outputPath), linkPath) | 236 os.symlink(os.path.basename(outputPath), linkPath) |
| 238 else: | 237 else: |
| 239 shutil.copyfile(outputPath, linkPath) | 238 shutil.copyfile(outputPath, linkPath) |
| 240 | 239 |
| 241 def build(self): | 240 def build(self): |
| 242 """ | 241 """ |
| 243 run the build command in the tempdir | 242 run the build command in the tempdir |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 except Exception, ex: | 492 except Exception, ex: |
| 494 print >>sys.stderr, "The build for %s failed:" % repo | 493 print >>sys.stderr, "The build for %s failed:" % repo |
| 495 traceback.print_exc() | 494 traceback.print_exc() |
| 496 | 495 |
| 497 file = open(nightlyConfigFile, 'wb') | 496 file = open(nightlyConfigFile, 'wb') |
| 498 nightlyConfig.write(file) | 497 nightlyConfig.write(file) |
| 499 | 498 |
| 500 | 499 |
| 501 if __name__ == '__main__': | 500 if __name__ == '__main__': |
| 502 main() | 501 main() |
| LEFT | RIGHT |