OLD | NEW |
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-present eyeo GmbH | 2 # Copyright (C) 2006-present 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 links.append(link) | 419 links.append(link) |
420 template = get_template(get_config().get('extensions', 'nightlyIndexPage
')) | 420 template = get_template(get_config().get('extensions', 'nightlyIndexPage
')) |
421 template.stream({'config': self.config, 'links': links}).dump(outputPath
) | 421 template.stream({'config': self.config, 'links': links}).dump(outputPath
) |
422 | 422 |
423 def read_downloads_lockfile(self): | 423 def read_downloads_lockfile(self): |
424 path = get_config().get('extensions', 'downloadLockFile') | 424 path = get_config().get('extensions', 'downloadLockFile') |
425 try: | 425 try: |
426 with open(path, 'r') as fp: | 426 with open(path, 'r') as fp: |
427 current = json.load(fp) | 427 current = json.load(fp) |
428 except IOError: | 428 except IOError: |
429 logging.warning('No lockfile found. Creating ' + path) | 429 logging.debug('No lockfile found at ' + path) |
430 current = {} | 430 current = {} |
431 | 431 |
432 return current | 432 return current |
433 | 433 |
434 def write_downloads_lockfile(self, values): | 434 def write_downloads_lockfile(self, values): |
435 path = get_config().get('extensions', 'downloadLockFile') | 435 path = get_config().get('extensions', 'downloadLockFile') |
436 with open(path, 'w') as fp: | 436 with open(path, 'w') as fp: |
437 json.dump(values, fp) | 437 json.dump(values, fp) |
438 | 438 |
439 def add_to_downloads_lockfile(self, platform, values): | 439 def add_to_downloads_lockfile(self, platform, values): |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 self.uploadToChromeWebStore() | 816 self.uploadToChromeWebStore() |
817 elif self.config.type == 'edge' and self.config.clientID and self.co
nfig.clientSecret and self.config.refreshToken and self.config.tenantID: | 817 elif self.config.type == 'edge' and self.config.clientID and self.co
nfig.clientSecret and self.config.refreshToken and self.config.tenantID: |
818 self.upload_to_windows_store() | 818 self.upload_to_windows_store() |
819 | 819 |
820 finally: | 820 finally: |
821 # clean up | 821 # clean up |
822 if self.tempdir: | 822 if self.tempdir: |
823 shutil.rmtree(self.tempdir, ignore_errors=True) | 823 shutil.rmtree(self.tempdir, ignore_errors=True) |
824 | 824 |
825 def download(self): | 825 def download(self): |
826 with open(get_config().get('extensions', 'downloadLockFile')) as fp: | 826 download_info = self.read_downloads_lockfile() |
827 download_info = json.load(fp) | |
828 | |
829 downloads = self.downloadable_repos.intersection(download_info.keys()) | 827 downloads = self.downloadable_repos.intersection(download_info.keys()) |
830 | 828 |
831 if self.config.type in downloads: | 829 if self.config.type in downloads: |
832 try: | 830 try: |
833 self.copyRepository() | 831 self.copyRepository() |
834 self.readGeckoMetadata() | 832 self.readGeckoMetadata() |
835 | 833 |
836 for data in download_info[self.config.type]: | 834 for data in download_info[self.config.type]: |
837 self.version = data['version'] | 835 self.version = data['version'] |
838 | 836 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 879 |
882 file = open(nightlyConfigFile, 'wb') | 880 file = open(nightlyConfigFile, 'wb') |
883 nightlyConfig.write(file) | 881 nightlyConfig.write(file) |
884 | 882 |
885 | 883 |
886 if __name__ == '__main__': | 884 if __name__ == '__main__': |
887 parser = argparse.ArgumentParser() | 885 parser = argparse.ArgumentParser() |
888 parser.add_argument('--download', action='store_true', default=False) | 886 parser.add_argument('--download', action='store_true', default=False) |
889 args = parser.parse_args() | 887 args = parser.parse_args() |
890 main(args.download) | 888 main(args.download) |
OLD | NEW |