def GetGCDRoot():
  """Gets the directory of the GCD emulator installation in the Cloud SDK.

  Raises:
    NoCloudSDKError: If there is no SDK root.
    NoGCDError: If the GCD installation dir does not exist.

  Returns:
    str, The path to the root of the GCD emulator installation within Cloud SDK.
  """
  sdk_root = util.GetCloudSDKRoot()
  gcd_dir = os.path.join(sdk_root, 'platform', 'gcd')
  if not os.path.isdir(gcd_dir):
    raise NoGCDError()
  return gcd_dir
예제 #2
0
파일: broker.py 프로젝트: bopopescu/SDK
    def __init__(self, address, config_file=None, conn_factory=None):
        """Constructor.

    Args:
      address: The host or host-port of the broker server. The server may
          already be running.
      config_file: The full path to the broker config file.
      conn_factory: Factory for HTTPConnection objects.
    """
        if config_file is not None:
            assert os.path.isabs(config_file)

        self._address = address
        self._config_file = config_file
        self._conn_factory = conn_factory

        self._host_port = arg_parsers.HostPort.Parse(address)
        self._broker_dir = os.path.join(util.GetCloudSDKRoot(), 'bin',
                                        'broker')
        self._current_platform = platforms.Platform.Current()
        self._process = None
        self._comm_thread = None
예제 #3
0
def GetGCDRoot(args):
    """Gets the directory of the GCD emulator installation in the Cloud SDK.

  Args:
    args: Arguments passed to the command.

  Raises:
    NoCloudSDKError: If there is no SDK root.
    NoGCDError: If the GCD installation dir does not exist.

  Returns:
    str, The path to the root of the GCD emulator installation within Cloud SDK.
  """
    sdk_root = util.GetCloudSDKRoot()
    if args.legacy:
        gcd_dir = os.path.join(sdk_root, 'platform', 'gcd')
    else:
        gcd_dir = os.path.join(sdk_root, 'platform',
                               'cloud-datastore-emulator')
    if not os.path.isdir(gcd_dir):
        raise NoGCDError()
    return gcd_dir
예제 #4
0
    def __init__(self, address, config_file=None, broker_dir=None):
        """Constructor.

    Args:
      address: (str) The host or host-port of the broker server. The server may
          already be running.
      config_file: (str) The full path to the broker config file.
      broker_dir: (str) A custom path to the broker directory.
    """
        if config_file is not None:
            assert os.path.isabs(config_file)

        self._address = address
        self._config_file = config_file
        if broker_dir:
            self._broker_dir = broker_dir
        else:
            self._broker_dir = os.path.join(util.GetCloudSDKRoot(), 'bin',
                                            'broker')

        self._host_port = arg_parsers.HostPort.Parse(address)
        self._current_platform = platforms.Platform.Current()
        self._process = None
        self._comm_thread = None
예제 #5
0
def GetPubSubRoot():
    pubsub_dir = os.path.join(util.GetCloudSDKRoot(), 'platform',
                              'pubsub-emulator')
    if not os.path.isdir(pubsub_dir):
        raise NoPubSubError('No pubsub directory found.')
    return pubsub_dir