1# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""App Engine config.
6
7This module is loaded before others and can be used to set up the
8App Engine environment. See:
9  https://cloud.google.com/appengine/docs/python/tools/appengineconfig
10"""
11
12import os
13
14from google.appengine.ext import vendor
15
16from perf_insights.endpoints import cloud_mapper
17
18appstats_SHELL_OK = True
19
20
21def _AddThirdPartyLibraries():
22  """Registers the third party libraries with App Engine.
23
24  In order for third-party libraries to be available in the App Engine
25  runtime environment, they must be added with vendor.add. The directories
26  added this way must be inside the App Engine project directory.
27  """
28  # The deploy script is expected to add links to third party libraries
29  # before deploying. If the directories aren't there (e.g. when running tests)
30  # then just ignore it.
31  for library_dir in (cloud_mapper.THIRD_PARTY_LIBRARIES +
32                      cloud_mapper.THIRD_PARTY_LIBRARIES_IN_SDK):
33    if os.path.exists(library_dir):
34      vendor.add(os.path.join(os.path.dirname(__file__), library_dir))
35
36
37_AddThirdPartyLibraries()
38