| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 if os.path.exists(os.path.join(baseDir, changelogFile)): | 358 if os.path.exists(os.path.join(baseDir, changelogFile)): |
| 359 link['changelog'] = changelogFile | 359 link['changelog'] = changelogFile |
| 360 links.append(link) | 360 links.append(link) |
| 361 template = get_template(get_config().get('extensions', 'nightlyIndexPage')) | 361 template = get_template(get_config().get('extensions', 'nightlyIndexPage')) |
| 362 template.stream({'config': self.config, 'links': links}).dump(outputPath) | 362 template.stream({'config': self.config, 'links': links}).dump(outputPath) |
| 363 | 363 |
| 364 def updateDocs(self): | 364 def updateDocs(self): |
| 365 if not self.config.type == 'gecko': | 365 if not self.config.type == 'gecko': |
| 366 return | 366 return |
| 367 | 367 |
| 368 docsdir = tempfile.mkdtemp(prefix='jsdoc') | 368 import buildtools.build as build |
| 369 command = ['hg', 'archive', '-R', get_config().get('extensions', 'jsdocRepos
itory'), '-r', 'default', docsdir] | 369 outputPath = os.path.join(self.config.docsDirectory, self.basename) |
| 370 subprocess.check_call(command) | 370 build.generateDocs(self.tempdir, None, [('--quiet', '')], [outputPath], self
.config.type) |
| 371 | |
| 372 try: | |
| 373 import buildtools.build as build | |
| 374 outputPath = os.path.join(self.config.docsDirectory, self.basename) | |
| 375 build.generateDocs(self.tempdir, None, [("-t", docsdir), ("-q", "")], [out
putPath], self.config.type) | |
| 376 finally: | |
| 377 shutil.rmtree(docsdir, ignore_errors=True) | |
| 378 | 371 |
| 379 def uploadToChromeWebStore(self): | 372 def uploadToChromeWebStore(self): |
| 380 # Google APIs use HTTP error codes with error message in body. So we add | 373 # Google APIs use HTTP error codes with error message in body. So we add |
| 381 # the response body to the HTTPError to get more meaningful error messages. | 374 # the response body to the HTTPError to get more meaningful error messages. |
| 382 | 375 |
| 383 class HTTPErrorBodyHandler(urllib2.HTTPDefaultErrorHandler): | 376 class HTTPErrorBodyHandler(urllib2.HTTPDefaultErrorHandler): |
| 384 def http_error_default(self, req, fp, code, msg, hdrs): | 377 def http_error_default(self, req, fp, code, msg, hdrs): |
| 385 raise urllib2.HTTPError(req.get_full_url(), code, '%s\n%s' % (msg, fp.re
ad()), hdrs, fp) | 378 raise urllib2.HTTPError(req.get_full_url(), code, '%s\n%s' % (msg, fp.re
ad()), hdrs, fp) |
| 386 | 379 |
| 387 opener = urllib2.build_opener(HTTPErrorBodyHandler) | 380 opener = urllib2.build_opener(HTTPErrorBodyHandler) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 except Exception, ex: | 510 except Exception, ex: |
| 518 print >>sys.stderr, "The build for %s failed:" % repo | 511 print >>sys.stderr, "The build for %s failed:" % repo |
| 519 traceback.print_exc() | 512 traceback.print_exc() |
| 520 | 513 |
| 521 file = open(nightlyConfigFile, 'wb') | 514 file = open(nightlyConfigFile, 'wb') |
| 522 nightlyConfig.write(file) | 515 nightlyConfig.write(file) |
| 523 | 516 |
| 524 | 517 |
| 525 if __name__ == '__main__': | 518 if __name__ == '__main__': |
| 526 main() | 519 main() |
| OLD | NEW |