Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: native_client_sdk/src/build_tools/update_nacl_manifest.py

Issue 10910101: fix pylint warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Script that reads omahaproxy and gsutil to determine version of SDK to put 6 """Script that reads omahaproxy and gsutil to determine version of SDK to put
7 in manifest. 7 in manifest.
8 """ 8 """
9 9
10 # pylint is convinced the email module is missing attributes
11 # pylint: disable=E1101
12
10 import buildbot_common 13 import buildbot_common
11 import csv 14 import csv
12 import cStringIO 15 import cStringIO
13 import email 16 import email
14 import manifest_util 17 import manifest_util
15 import optparse 18 import optparse
16 import os 19 import os
17 import posixpath 20 import posixpath
18 import re 21 import re
19 import smtplib 22 import smtplib
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 platforms = [] 88 platforms = []
86 for url in archive_urls: 89 for url in archive_urls:
87 platform = GetPlatformFromArchiveUrl(url) 90 platform = GetPlatformFromArchiveUrl(url)
88 if platform: 91 if platform:
89 platforms.append(platform) 92 platforms.append(platform)
90 return platforms 93 return platforms
91 94
92 95
93 class Delegate(object): 96 class Delegate(object):
94 """Delegate all external access; reading/writing to filesystem, gsutil etc.""" 97 """Delegate all external access; reading/writing to filesystem, gsutil etc."""
98
95 def GetRepoManifest(self): 99 def GetRepoManifest(self):
96 """Read the manifest file from the NaCl SDK repository. 100 """Read the manifest file from the NaCl SDK repository.
97 101
98 This manifest is used as a template for the auto updater; only pepper 102 This manifest is used as a template for the auto updater; only pepper
99 bundles with no archives are considered for auto updating. 103 bundles with no archives are considered for auto updating.
100 104
101 Returns: 105 Returns:
102 A manifest_util.SDKManifest object read from the NaCl SDK repo.""" 106 A manifest_util.SDKManifest object read from the NaCl SDK repo."""
103 raise NotImplementedError() 107 raise NotImplementedError()
104 108
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 def GsUtil_cp(self, src, dest, stdin=None): 154 def GsUtil_cp(self, src, dest, stdin=None):
151 """Runs gsutil cp |src| |dest| 155 """Runs gsutil cp |src| |dest|
152 156
153 Args: 157 Args:
154 src: The file path or url to copy from. 158 src: The file path or url to copy from.
155 dest: The file path or url to copy to. 159 dest: The file path or url to copy to.
156 stdin: If src is '-', this is used as the stdin to give to gsutil. The 160 stdin: If src is '-', this is used as the stdin to give to gsutil. The
157 effect is that text in stdin is copied to |dest|.""" 161 effect is that text in stdin is copied to |dest|."""
158 raise NotImplementedError() 162 raise NotImplementedError()
159 163
160
161 def Print(self, *args): 164 def Print(self, *args):
162 """Print a message.""" 165 """Print a message."""
163 raise NotImplementedError() 166 raise NotImplementedError()
164 167
165 168
166 class RealDelegate(Delegate): 169 class RealDelegate(Delegate):
167 def __init__(self, dryrun=False, gsutil=None): 170 def __init__(self, dryrun=False, gsutil=None):
171 super(RealDelegate, self).__init__()
168 self.dryrun = dryrun 172 self.dryrun = dryrun
169 if gsutil: 173 if gsutil:
170 self.gsutil = gsutil 174 self.gsutil = gsutil
171 else: 175 else:
172 self.gsutil = buildbot_common.GetGsutil() 176 self.gsutil = buildbot_common.GetGsutil()
173 177
174 def GetRepoManifest(self): 178 def GetRepoManifest(self):
175 """See Delegate.GetRepoManifest""" 179 """See Delegate.GetRepoManifest"""
176 with open(REPO_MANIFEST, 'r') as sdk_stream: 180 with open(REPO_MANIFEST, 'r') as sdk_stream:
177 sdk_json_string = sdk_stream.read() 181 sdk_json_string = sdk_stream.read()
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 shared_version_generator: A generator that will yield (version, channel) 310 shared_version_generator: A generator that will yield (version, channel)
307 tuples in order of most recent to least recent. 311 tuples in order of most recent to least recent.
308 allow_trunk_revisions: If True, will search for archives using the 312 allow_trunk_revisions: If True, will search for archives using the
309 trunk revision that matches the branch version. 313 trunk revision that matches the branch version.
310 Returns: 314 Returns:
311 A tuple (version, channel, archives). The version is a string such as 315 A tuple (version, channel, archives). The version is a string such as
312 "19.0.1084.41". The channel is one of ('stable', 'beta', 'dev', 316 "19.0.1084.41". The channel is one of ('stable', 'beta', 'dev',
313 'canary'). |archives| is a list of archive URLs.""" 317 'canary'). |archives| is a list of archive URLs."""
314 version = None 318 version = None
315 skipped_versions = [] 319 skipped_versions = []
320 channel = ''
316 while True: 321 while True:
317 try: 322 try:
318 version, channel = shared_version_generator.next() 323 version, channel = shared_version_generator.next()
319 except StopIteration: 324 except StopIteration:
320 msg = 'No shared version for platforms: %s\n' % (', '.join(platforms)) 325 msg = 'No shared version for platforms: %s\n' % (', '.join(platforms))
321 msg += 'Last version checked = %s.\n' % (version,) 326 msg += 'Last version checked = %s.\n' % (version,)
322 if skipped_versions: 327 if skipped_versions:
323 msg += 'Versions skipped due to missing archives:\n' 328 msg += 'Versions skipped due to missing archives:\n'
324 for version, channel, archives in skipped_versions: 329 for version, channel, archives in skipped_versions:
325 if archives: 330 if archives:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 subject = '[%s] Failed to update manifest' % (scriptname,) 627 subject = '[%s] Failed to update manifest' % (scriptname,)
623 text = '%s failed.\n\nSTDERR:\n%s\n' % (scriptname, sys.stderr.getvalue()) 628 text = '%s failed.\n\nSTDERR:\n%s\n' % (scriptname, sys.stderr.getvalue())
624 SendMail(options.mailfrom, options.mailto, subject, text) 629 SendMail(options.mailfrom, options.mailto, subject, text)
625 sys.exit(1) 630 sys.exit(1)
626 else: 631 else:
627 raise 632 raise
628 633
629 634
630 if __name__ == '__main__': 635 if __name__ == '__main__':
631 sys.exit(main(sys.argv)) 636 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698