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 16appstats_SHELL_OK = True 17 18# Directories in catapult/third_party required by uploader/corpus cleanup. 19THIRD_PARTY_LIBRARIES = [ 20 'apiclient', 21 'uritemplate', 22] 23# Directories in trace_processor/third_party required by uploader/corpus 24# cleanup. 25THIRD_PARTY_LIBRARIES_IN_TRACE_PROCESSOR = [ 26 'cloudstorage', 27] 28# Libraries bundled with the App Engine SDK. 29THIRD_PARTY_LIBRARIES_IN_SDK = [ 30 'httplib2', 31 'oauth2client', 32 'six', 33] 34 35def _AddThirdPartyLibraries(): 36 """Registers the third party libraries with App Engine. 37 38 In order for third-party libraries to be available in the App Engine 39 runtime environment, they must be added with vendor.add. The directories 40 added this way must be inside the App Engine project directory. 41 """ 42 # The deploy script is expected to add links to third party libraries 43 # before deploying. If the directories aren't there (e.g. when running tests) 44 # then just ignore it. 45 for library_dir in (THIRD_PARTY_LIBRARIES + 46 THIRD_PARTY_LIBRARIES_IN_TRACE_PROCESSOR + 47 THIRD_PARTY_LIBRARIES_IN_SDK): 48 if os.path.exists(library_dir): 49 vendor.add(os.path.join(os.path.dirname(__file__), library_dir)) 50 51 52_AddThirdPartyLibraries() 53