~blamar/+junk/openstack-api-arrrg

« back to all changes in this revision

Viewing changes to nova/vendor.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
# Copyright [2010] [Anso Labs, LLC]
 
3
 
4
#    Licensed under the Apache License, Version 2.0 (the "License");
 
5
#    you may not use this file except in compliance with the License.
 
6
#    You may obtain a copy of the License at
 
7
 
8
#        http://www.apache.org/licenses/LICENSE-2.0
 
9
 
10
#    Unless required by applicable law or agreed to in writing, software
 
11
#    distributed under the License is distributed on an "AS IS" BASIS,
 
12
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
#    See the License for the specific language governing permissions and
 
14
#    limitations under the License.
 
15
 
 
16
"""
 
17
Get our vendor folders into the system path.
 
18
"""
 
19
 
 
20
import os
 
21
import sys
 
22
 
 
23
# abspath/__file__/../vendor
 
24
VENDOR_PATH = os.path.abspath(
 
25
    os.path.join(os.path.dirname(os.path.dirname(__file__)), 'vendor'))
 
26
 
 
27
if not os.path.exists(VENDOR_PATH):
 
28
    print 'warning: no vendor libraries included'
 
29
else:
 
30
  paths = [VENDOR_PATH,
 
31
           os.path.join(VENDOR_PATH, 'pymox'),
 
32
           os.path.join(VENDOR_PATH, 'tornado'),
 
33
           os.path.join(VENDOR_PATH, 'python-gflags'),
 
34
           os.path.join(VENDOR_PATH, 'python-daemon'),
 
35
           os.path.join(VENDOR_PATH, 'lockfile'),
 
36
           os.path.join(VENDOR_PATH, 'boto'),
 
37
           os.path.join(VENDOR_PATH, 'Twisted-10.0.0'),
 
38
           os.path.join(VENDOR_PATH, 'redis-py'),
 
39
           ]
 
40
 
 
41
  for p in paths:
 
42
    if p not in sys.path:
 
43
      sys.path.insert(0, p)