Python google.appengine.ext.vendor 模块,add() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用google.appengine.ext.vendor.add()

项目:endpoints-python    作者:cloudendpoints    | 项目源码 | 文件源码
def _SetupPaths():
  """Sets up the sys.path with special directories for endpointscfg.py."""
  sdk_path = _FindSdkPath()
  if sdk_path:
    sys.path.append(sdk_path)
    try:
      import dev_appserver  # pylint: disable=g-import-not-at-top
      if hasattr(dev_appserver, 'fix_sys_path'):
        dev_appserver.fix_sys_path()
      else:
        logging.warning(_NO_FIX_SYS_PATH_WARNING)
    except ImportError:
      logging.warning(_IMPORT_ERROR_WARNING)
  else:
    logging.warning(_NOT_FOUND_WARNING)

  # Add the path above this directory, so we can import the endpoints package
  # from the user's app code (rather than from another, possibly outdated SDK).
  # pylint: disable=g-import-not-at-top
  from google.appengine.ext import vendor
  vendor.add(os.path.dirname(os.path.dirname(__file__)))
项目:dancedeets-monorepo    作者:mikelambert    | 项目源码 | 文件源码
def setup():
    if os.path.exists('frankenserver/python'):
        sdk_path = 'frankenserver/python'
    else:  # running on travis
        sdk_path = '../google_appengine'

    # If the SDK path points to a Google Cloud SDK installation
    # then we should alter it to point to the GAE platform location.
    if os.path.exists(os.path.join(sdk_path, 'platform/google_appengine')):
        sdk_path = os.path.join(sdk_path, 'platform/google_appengine')

    # Make sure google.appengine.* modules are importable.
    fixup_paths(sdk_path)

    # Make sure all bundled third-party packages are available.
    import dev_appserver
    dev_appserver.fix_sys_path()
    from google.appengine.ext import vendor
    vendor.add('lib-local')
    vendor.add('lib-both')

    # Loading appengine_config from the current project ensures that any
    # changes to configuration there are available to all tests (e.g.
    # sys.path modifications, namespaces, etc.)
    try:
        import appengine_config
        (appengine_config)
    except ImportError:
        print('Note: unable to import appengine_config.')