scripts/export_image.py
author Todd Larsen <tlarsen@google.com>
Fri, 06 Jun 2008 04:10:52 +0000
changeset 46 0fb942ba3046
child 50 43df6d7be888
permissions -rwxr-xr-x
Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local filesystem. Patch by: Todd Larsen TO BE REVIEWED Review issue: 321 Review URL: http://codereviews.googleopensourceprograms.com/321
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""Script to export a Google App Engine "image" of a Melange application.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
For details:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  trunk/scripts/export_image.py --help
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    21
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
Default values for flags can be specified in valid Python syntax in the
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
~/.soc_scripts_settings file.  See settings.py for details.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
"""
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    25
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    26
__authors__ = [
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
  # alphabetical order by last name, please
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
  '"Todd Larsen" <tlarsen@google.com>',
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
]
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    30
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
import os
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
import sys
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
import pysvn
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
from trunk.scripts import app_image
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
from trunk.scripts import settings
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    39
from trunk.scripts import svn_helper
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    40
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    41
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    42
def buildOptionList(defaults):
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    43
  """Returns a list of command-line settings.Options for this script.
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    44
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    45
  Args:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    46
    defaults: dict of possible pre-loaded default values (may be empty)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    47
  """
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    48
  def_repo = defaults.get('repo')
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    49
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    50
  if def_repo:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    51
    repo_help_msg = 'SVN repository; default is %s' % def_repo
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    52
  else:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    53
    repo_help_msg = 'SVN repository; REQUIRED if default unavailable'
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    54
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    55
  return [
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    56
      settings.Option(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    57
          '-R', '--repo', action='store', dest='repo',
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    58
          default=def_repo, help=repo_help_msg),
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    59
      settings.Option(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    60
          '-s', '--src', action='store', dest='src', required=True,
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    61
          help='(REQUIRED) name of source app in /trunk/apps/ to export'),
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    62
      settings.Option(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    63
          '-i', '--image', action='store', dest='image', required=True,
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    64
          help='(REQUIRED) exported image destination'),
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    65
      settings.Option(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    66
          '-r', '--rev', type='int', action='store', dest='rev',
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    67
          default=None, help='optional revision number on which to export'),
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    68
  ]
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    69
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    70
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    71
def main(args):
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    72
  # attempt to read the common trunk/scripts settings file
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    73
  defaults = settings.readPythonSettingsOrDie(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    74
      parser=settings.OptionParser(option_list=buildOptionList({})))
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    75
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    76
  # create the command-line options parser
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    77
  parser = settings.makeOptionParserOrDie(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    78
      option_list=buildOptionList(defaults))
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    79
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
  # parse the command-line options
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    81
  options, args = settings.parseOptionsOrDie(parser, args)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    82
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    83
  # ensure that various paths end with the / separator
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    84
  src, image, repo = svn_helper.formatDirPaths(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    85
      options.src, options.image, options.repo)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    86
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    87
  # expand and make "OS-agnostic" the proposed App Engine image path
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    88
  # (which is why no working copy path is needed or supplied)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    89
  image = svn_helper.getExpandedWorkingCopyPath(image)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    90
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    91
  setup_errors = []
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    92
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    93
  # dirname() called twice because image always ends with os.sep
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    94
  parent_dir = os.path.dirname(os.path.dirname(image))
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    95
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    96
  if os.path.isdir(image):
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    97
    setup_errors.extend(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    98
        ['--image destination directory must not already exist:',
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    99
         '  %s' % image])
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   100
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   101
  if not os.path.isdir(parent_dir):
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   102
    try:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   103
      os.makedirs(parent_dir)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   104
      print 'Created --image parent directory:\n %s\n' % parent_dir
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   105
    except (IOError, OSError), fs_err:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   106
      setup_errors.extend(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   107
          ['--image parent directory could not be created:',
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   108
           '  %s' % parent_dir,
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   109
           '  %s: %s' % (fs_err.__class__.__name__,
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   110
                       ' '.join([str(arg) for arg in fs_err.args]))])
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   111
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   112
  if not options.repo:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   113
    setup_errors.extend(
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   114
        ['--repo must be supplied or have a settings file default'])
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   115
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   116
  if setup_errors:
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   117
    return settings.printErrorsAndUsage(setup_errors, parser)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   118
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   119
  def callbackGetLogMessage():
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   120
    return True, 'trunk/apps/%s application exported to %s' % (src, image)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   121
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   122
  client = svn_helper.getPySvnClient()
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   123
  # this should never actually be called, but just in case...
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   124
  client.callback_get_log_message = callbackGetLogMessage
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   125
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   126
  # export trunk/apps/<src> first, so image root directory will exist
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   127
  app_image.exportFromSrcApp(src, repo, image, rev=options.rev)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   128
  app_image.exportFromThirdParty(repo, image, rev=options.rev)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   129
  app_image.exportFromFramework(repo, image, rev=options.rev)
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   130
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   131
  return 0
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   132
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   133
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   134
if __name__ == '__main__':
0fb942ba3046 Script to 'svn export' /trunk/apps/<app>, /thirdparty/, /trunk/soc/ to local
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   135
  sys.exit(main(sys.argv))