Beispiel #1
0
def main(args):
    # gae.py may be symlinked into app's directory or its subdirectory (to avoid
    # typing --app-dir all the time). If linked into subdirectory, discover root
    # by locating app.yaml. It is used for Python GAE apps and one-module Go apps
    # that have all YAMLs in app root dir. For multi-module Go apps (that put
    # app.yaml into per-module dir) gae.py MUST be symlinked into app root dir.
    app_dir = None
    if IS_SYMLINKED:
        script_dir = os.path.dirname(os.path.abspath(__file__))
        app_yaml_path = find_app_yaml(script_dir)
        if app_yaml_path:
            app_dir = os.path.dirname(app_yaml_path)
        else:
            app_dir = script_dir

    colorama.init()
    dispatcher = subcommand.CommandDispatcher(__name__)
    try:
        return dispatcher.execute(OptionParser(app_dir), args)
    except gae_sdk_utils.LoginRequiredError:
        print >> sys.stderr, 'Login first using \'login\' subcommand.'
        return 1
    except KeyboardInterrupt:
        # Don't dump stack traces on Ctrl+C, it's expected flow in some commands.
        print >> sys.stderr, '\nInterrupted'
        return 1
Beispiel #2
0
def main(args):
    # gae.py may be symlinked into app's directory or its subdirectory (to avoid
    # typing --app-dir all the time). If linked into subdirectory, discover root
    # by locating app.yaml. It is used for Python GAE apps and one-module Go apps
    # that have all YAMLs in app root dir.
    app_dir = None
    if IS_SYMLINKED:
        script_dir = os.path.dirname(os.path.abspath(__file__))
        app_dir = find_app_dir(script_dir)

    # If not symlinked into an app directory, try to discover app root starting
    # from cwd.
    app_dir = app_dir or find_app_dir(os.getcwd())

    colorama.init()
    dispatcher = subcommand.CommandDispatcher(__name__)
    try:
        return dispatcher.execute(OptionParser(app_dir), args)
    except gae_sdk_utils.BadEnvironmentConfig as e:
        print >> sys.stderr, str(e)
        return 1
    except gae_sdk_utils.LoginRequiredError:
        print >> sys.stderr, 'Login first using \'login\' subcommand.'
        return 1
    except KeyboardInterrupt:
        # Don't dump stack traces on Ctrl+C, it's expected flow in some commands.
        print >> sys.stderr, '\nInterrupted'
        return 1
Beispiel #3
0
def main(args):
    # gae.py may be symlinked into an app's directory or subdirectory (to avoid
    # typing --app-dir all the time). If linked into a subdirectory, discover root
    # by locating app.yaml. It is used for Python GAE apps and single-service Go
    # apps that have all YAMLs in app root dir.
    default_app_dir = None
    if IS_SYMLINKED:
        script_dir = os.path.dirname(os.path.abspath(__file__))
        default_app_dir = _find_app_dir(script_dir)

    # If not symlinked into an app directory, try to discover app root starting
    # from cwd.
    default_app_dir = default_app_dir or _find_app_dir(os.getcwd())

    colorama.init()
    dispatcher = subcommand.CommandDispatcher(__name__)
    try:
        return dispatcher.execute(OptionParser(default_app_dir), args)
    except gae_sdk_utils.Error as e:
        print(str(e), file=sys.stderr)
        return 1
    except KeyboardInterrupt:
        # Don't dump stack traces on Ctrl+C, it's expected flow in some commands.
        print('\nInterrupted', file=sys.stderr)
        return 1
Beispiel #4
0
def main(args, app_dir=None):
    """Main entry points.

  Args:
    args: command line arguments excluding executable name.
    app_dir: directory with app.yaml, or None to autodiscover based on __file__.
  """
    # Search for app.yaml in parent directory. If found, it means gae.py was
    # symlinked to some GAE app directory. Such symlink allows to avoid typing
    # --app-dir parameter all the time.
    if app_dir is None:
        script_dir = os.path.dirname(os.path.abspath(__file__))
        app_yaml_path = gae_sdk_utils.find_app_yaml(script_dir)
        if app_yaml_path:
            app_dir = os.path.dirname(app_yaml_path)

    colorama.init()
    dispatcher = subcommand.CommandDispatcher(__name__)
    try:
        return dispatcher.execute(OptionParser(app_dir), args)
    except gae_sdk_utils.LoginRequiredError:
        print >> sys.stderr, 'Login first using \'login\' subcommand.'
        return 1
    except KeyboardInterrupt:
        # Don't dump stack traces on Ctrl+C, it's expected flow in some commands.
        print >> sys.stderr, '\nInterrupted'
        return 1
Beispiel #5
0
def main(argv):
  dispatcher = subcommand.CommandDispatcher(__name__)
  parser = logging_utils.OptionParserWithLogging(
        version=__version__, verbose=int(os.environ.get('ISOLATE_DEBUG', 0)))
  try:
    return dispatcher.execute(parser, argv)
  except isolated_format.MappingError as e:
    print >> sys.stderr, 'Failed to find an input file: %s' % e
    return 1
  except ExecutionError as e:
    print >> sys.stderr, 'Execution failure: %s' % e
    return 1
Beispiel #6
0
def main(args):
    dispatcher = subcommand.CommandDispatcher(__name__)
    return dispatcher.execute(OptionParserAuth(version=__version__), args)