コード例 #1
0
def Deploy(paths, args, version=None):
    """Deploys a new version of an App Engine app from a temporary directory.

  Args:
    paths: List of paths to files and directories that should be linked
        (or copied) in the deployment directory.
    args: Arguments passed to "gcloud app deploy".
  """
    if version is None:
        version = _VersionName()
    with temp_deployment_dir.TempDeploymentDir(paths,
                                               use_symlinks=False) as temp_dir:
        print('Deploying from "%s".' % temp_dir)

        # google-cloud-sdk/bin/gcloud is a shell script, which we can't subprocess
        # on Windows with shell=False. So, execute the Python script directly.
        if os.name == 'nt':
            script_path = _FindScriptInPath('gcloud.cmd')
        else:
            script_path = _FindScriptInPath('gcloud')
        if not script_path:
            print('This script requires the Google Cloud SDK to be in PATH.')
            print('Install at https://cloud.google.com/sdk and then run')
            print('`gcloud components install app-engine-python`')
            sys.exit(1)

        subprocess.call([
            script_path, 'app', 'deploy', '--no-promote', '--quiet',
            '--version', version
        ] + args,
                        cwd=temp_dir)
コード例 #2
0
ファイル: appengine_deploy.py プロジェクト: subhanshuja/ofa
def AppcfgUpdate(paths, app_id, service_name=None):
  """Deploys a new version of an App Engine app from a temporary directory.

  Args:
    paths: List of paths to files and directories that should be linked
        (or copied) in the deployment directory.
    app_id: The application ID to use.
  """
  try:
    import appcfg  # pylint: disable=unused-variable
  except ImportError:
    # TODO(qyearsley): Put the App Engine SDK in the path with the
    # binary dependency manager.
    # See: https://github.com/catapult-project/catapult/issues/2135
    print 'This script requires the App Engine SDK to be in PYTHONPATH.'
    sys.exit(1)
  with temp_deployment_dir.TempDeploymentDir(
      paths, use_symlinks=False) as temp_dir:
    print 'Deploying from "%s".' % temp_dir
    _Run([
        module_finder.FindModule('appcfg'),
        '--application=%s' % app_id,
        '--version=%s' % _VersionName(),
        'update',
        os.path.join(temp_dir, service_name) if service_name else temp_dir,
    ])
コード例 #3
0
def DevAppserver(paths, args):
    """Starts a dev server for an App Engine app.

  Args:
    paths: List of paths to files and directories that should be linked
        (or copied) in the deployment directory.
    args: List of additional arguments to pass to the dev server.
  """
    with temp_deployment_dir.TempDeploymentDir(paths) as temp_dir:
        print('Running dev server on "%s".' % temp_dir)

        script_path = _FindScriptInPath('dev_appserver.py')
        if not script_path:
            print('This script requires the App Engine SDK to be in PATH.')
            sys.exit(1)

        subprocess.call([sys.executable, script_path] + args + [temp_dir])
コード例 #4
0
def DevAppserver(paths, args):
    """Starts a dev server for an App Engine app.

  Args:
    paths: List of paths to files and directories that should be linked
        (or copied) in the deployment directory.
    args: List of additional arguments to pass to the dev server.
  """
    try:
        import dev_appserver  # pylint: disable=unused-variable
    except ImportError:
        # TODO(qyearsley): Put the App Engine SDK in the path with the
        # binary dependency manager.
        print 'This script requires the App Engine SDK to be in PYTHONPATH.'
        sys.exit(1)
    with temp_deployment_dir.TempDeploymentDir(paths) as temp_dir:
        print 'Running dev server on "%s".' % temp_dir
        subprocess.call([module_finder.FindModule('dev_appserver')] + args +
                        [temp_dir])
コード例 #5
0
def DevAppserver(paths, args, reuse_path=None):
    """Starts a dev server for an App Engine app.

  Args:
    paths: List of paths to files and directories that should be linked (or
      copied) in the deployment directory.
    args: List of additional arguments to pass to the dev server.
    reuse_path: If not None, will re-use an existing path (string) as the
      temporary directory from which the DevAppserver will be run from.
  """
    with temp_deployment_dir.TempDeploymentDir(
            paths, reuse_path=reuse_path) as temp_dir:
        print 'Running dev server on "%s".' % temp_dir

        script_path = _FindScriptInPath('dev_appserver.py')
        if not script_path:
            print 'This script requires the App Engine SDK to be in PATH.'
            sys.exit(1)

        subprocess.call([sys.executable, script_path] +
                        _AddTempDirToYamlPathArgs(temp_dir, args))
コード例 #6
0
def AppcfgUpdate(paths, app_id):
    """Deploys a new version of an App Engine app from a temporary directory.

  Args:
    paths: List of paths to files and directories that should be linked
        (or copied) in the deployment directory.
    app_id: The application ID to use.
  """
    try:
        import appcfg  # pylint: disable=unused-variable
    except ImportError:
        # TODO(qyearsley): Put the App Engine SDK in the path with the
        # binary dependency manager.
        print 'This script requires the App Engine SDK to be in PYTHONPATH.'
        sys.exit(1)
    with temp_deployment_dir.TempDeploymentDir(paths) as temp_dir:
        print 'Deploying from "%s".' % temp_dir
        _Run([
            module_finder.FindModule('appcfg'),
            '--application=%s' % app_id,
            '--version=%s' % _VersionName(),
            'update',
            temp_dir,
        ])