Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: infra/ext/__init__.py

Issue 381043002: Add a virtualenv-based python bootstrapping service to infra. (Closed) Base URL: https://chromium.googlesource.com/infra/infra@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 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 import os
6 import sys
7
8 # Explicit import paths for sub-projects that don't follow the
9 # 'infra/ext/<package>/<package>/' directory layout.
10 EXTPACKAGES = {
11 'httplib2': os.path.join('httplib2', 'python' + str(sys.version_info[0])),
12 'pytz': os.path.join('pytz', 'src'),
13 }
14
15
16 def _add_ext_dirs_to_path():
17 base = os.path.dirname(os.path.abspath(__file__))
18
19 for d in os.listdir(base):
20 full = os.path.join(base, EXTPACKAGES.get(d, d))
21 if os.path.isdir(full):
22 # TODO(iannucci): look for egg
23 # Needed to support absolute imports in sub-projects (e.g. pytz has
24 # imports like: from pytz.exceptions import AmbiguousTimeError).
25 sys.path.insert(0, full)
26 # Needed to support 'import infra.ext.foo' syntax.
27 __path__.append(full)
28
29 _add_ext_dirs_to_path()
30
31 # Enough of a hint for pylint / jedi (autocompletion) to find and follow the
32 # imports, but doesn't make python import them immediately at runtime.
33 #
34 # This list should always contain a complete list of all modules in ext.
35 if False:
36 import argcomplete
37 import dateutil
38 import httplib2
39 import oauth2client
40 import pytz
41 import requests
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698