Style fixes for release modules.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Mon, 16 Mar 2009 11:57:50 +0000
changeset 1888 ef350db7f753
parent 1887 8b71f4e58f39
child 1889 4356a9201d20
Style fixes for release modules. Patch by: Pawel Solyga Reviewed by: to-be-reviewed
scripts/release/error.py
scripts/release/log.py
scripts/release/release.py
scripts/release/subversion.py
scripts/release/util.py
--- a/scripts/release/error.py	Sun Mar 15 22:32:05 2009 +0000
+++ b/scripts/release/error.py	Mon Mar 16 11:57:50 2009 +0000
@@ -20,11 +20,14 @@
 
 class Error(Exception):
   """Base class for release script exceptions."""
+  pass
 
 
 class ObstructionError(Error):
   """An operation was obstructed by existing data."""
+  pass
 
 
 class ExpectationFailed(Error):
   """An unexpected state was encountered by an automated step."""
+  pass
--- a/scripts/release/log.py	Sun Mar 15 22:32:05 2009 +0000
+++ b/scripts/release/log.py	Mon Mar 16 11:57:50 2009 +0000
@@ -25,6 +25,7 @@
     '"David Anderson" <dave@natulte.net>',
     ]
 
+
 import logging
 import sys
 
--- a/scripts/release/release.py	Sun Mar 15 22:32:05 2009 +0000
+++ b/scripts/release/release.py	Mon Mar 16 11:57:50 2009 +0000
@@ -41,6 +41,7 @@
     '"David Anderson" <dave@natulte.net>',
     ]
 
+
 import functools
 import os
 import re
@@ -70,10 +71,12 @@
 
 class AbortedByUser(Error):
   """The operation was aborted by the user."""
+  pass
 
 
 class FileAccessError(Error):
   """An error occured while accessing a file."""
+  pass
 
 
 def getString(prompt):
@@ -142,9 +145,9 @@
     prompt: The prompt to print right before accepting input.
     choices: The list of string choices to display.
     done: If not None, the list of indices of previously
-          selected/completed choices.
+      selected/completed choices.
     suggest: If not None, the index of the choice to highlight as
-             the suggested choice.
+      the suggested choice.
 
   Returns:
     The index in the choices list of the selection the user made.
@@ -249,8 +252,7 @@
     """Check out the initial release repository.
 
     Will also select the latest release branch, if any, so that
-    the end state is a fully ready to function release
-    environment.
+    the end state is a fully ready to function release environment.
     """
     log.info('Checking out the release repository')
 
@@ -299,8 +301,8 @@
 
     Args:
       release: The version number of a Melange release already
-           imported in the release repository, or None to
-           activate no branch.
+        imported in the release repository, or None to activate 
+        no branch.
 
     """
     if release is None:
@@ -367,8 +369,7 @@
         out.append('application: socghop')
       elif stripped_line.startswith('version:'):
         out.append(line.lstrip() + 'g0')
-        out.append('# * initial Google fork of Melange ' +
-               self.branch)
+        out.append('# * initial Google fork of Melange ' + self.branch)
       else:
         out.append(line)
     linesToFile(self.wc.path(yaml_path), out)
@@ -420,15 +421,14 @@
       externals.append('%s -r %d %s' % (release, release_rev, tag_url))
       self.wc.propset('svn:externals', '\n'.join(externals), 'vendor/soc')
       self.wc.commit('Add svn:externals entry to pull in Melange '
-               'release %s at r%d.' % (release, release_rev))
+          'release %s at r%d.' % (release, release_rev))
 
       # Export the tag into the release repository's branches
       subversion.export(tag_url, release_rev, self.wc.path(branch_dir))
 
       # Add and commit the branch add (very long operation!)
       self.wc.add([branch_dir])
-      self.wc.commit('Branch of Melange release %s' % release,
-               branch_dir)
+      self.wc.commit('Branch of Melange release %s' % release, branch_dir)
       self._switchBranch(release)
 
       # Commit the production GSoC configuration and
@@ -451,8 +451,7 @@
       raise error.ExpectationFailed(
         'Retrieved diff is empty. '
         'Did you accidentally cherry-pick a branch change?')
-    util.run(['patch', '-p0'], cwd=self.wc.path(self.branch_dir),
-         stdin=diff)
+    util.run(['patch', '-p0'], cwd=self.wc.path(self.branch_dir), stdin=diff)
     self.wc.addRemove(self.branch_dir)
 
     yaml_path = self.wc.path(self._branchPath('app/app.yaml'))
@@ -464,7 +463,7 @@
         base, patch = line.rsplit('g', 1)
         new_version = '%sg%d' % (base, int(patch) + 1)
         message = ('Cherry-picked r%d from /p/soc/ to fix issue %d' %
-               (rev, bug))
+            (rev, bug))
         out.append('version: ' + new_version)
         out.append('# * ' + message)
         updated_patchlevel = True
@@ -518,8 +517,7 @@
 
       try:
         choice = getChoice('Main menu:', 'Your choice?',
-                   self.MENU_STRINGS, done=done,
-                   suggest=suggested_next)
+          self.MENU_STRINGS, done=done, suggest=suggested_next)
       except (KeyboardInterrupt, AbortedByUser):
         log.info('Exiting.')
         return
--- a/scripts/release/subversion.py	Sun Mar 15 22:32:05 2009 +0000
+++ b/scripts/release/subversion.py	Mon Mar 16 11:57:50 2009 +0000
@@ -28,6 +28,7 @@
     '"David Anderson" <dave@natulte.net>',
     ]
 
+
 import error
 import util
 
@@ -35,16 +36,15 @@
 def export(url, revision, dest_path):
   """Export the contents of a repository to a local path.
 
-  Note that while the underlying 'svn export' only requires a URL, we
-  require that both a URL and a revision be specified, to fully
+  Note that while the underlying 'svn export' only requires a URL, 
+  we require that both a URL and a revision be specified, to fully
   qualify the data to export.
 
   Args:
     url: The repository URL to export.
     revision: The revision to export.
     dest_path: The destination directory for the export. Note that
-               this is an absolute path, NOT a working copy relative
-               path.
+      this is an absolute path, NOT a working copy relative path.
     """
   assert os.path.isabs(dest_path)
   if os.path.exists(dest_path):
@@ -130,7 +130,6 @@
       path: The working copy path to scan.
 
     Returns:
-
       Two lists. The first is a list of all unknown paths
       (subversion has no knowledge of them), the second is a list
       of missing paths (subversion knows about them, but can't
--- a/scripts/release/util.py	Sun Mar 15 22:32:05 2009 +0000
+++ b/scripts/release/util.py	Mon Mar 16 11:57:50 2009 +0000
@@ -25,6 +25,7 @@
     '"David Anderson" <dave@natulte.net>',
     ]
 
+
 import os.path
 import re
 try:
@@ -44,6 +45,7 @@
 
 class SubprocessFailed(Error):
   """A subprocess returned a non-zero error code."""
+  pass
 
 
 # The magic escape sequence understood by modern terminal emulators to
@@ -167,9 +169,9 @@
       by its argument vector.
     cwd: Run the program from this directory.
     capture: If True, capture the program's stdout stream. If False,
-         stdout will output to sys.stdout.
+      stdout will output to sys.stdout.
     split_capture: If True, return the captured output as a list of
-           lines. Else, return as a single unaltered string.
+      lines. Else, return as a single unaltered string.
     stdin: The string to feed to the program's stdin stream.
 
   Returns:
@@ -178,8 +180,7 @@
     nothing is returned.
 
   Raises:
-    SubprocessFailed: The subprocess exited with a non-zero exit
-            code.
+    SubprocessFailed: The subprocess exited with a non-zero exit code.
   """
   log.debug(colorize('# ' + ' '.join(argv), WHITE, bold=True))
 
@@ -203,6 +204,7 @@
   stdout = StringIO.StringIO() if capture else log.FileLikeLogger()
   out_adapter = _PipeAdapter(process.stdout, stdout)
   err_adapter = _PipeAdapter(process.stderr, log.FileLikeLogger())
+  
   if stdin:
     process.stdin.write(stdin)