~hudson-openstack/nova/trunk

« back to all changes in this revision

Viewing changes to bin/nova-api

  • Committer: Soren Hansen
  • Date: 2010-09-08 08:45:39 UTC
  • mto: This revision was merged to the branch mainline in revision 270.
  • Revision ID: soren.hansen@rackspace.com-20100908084539-xvmpclaaoja9ot5e
Make the scripts in bin/ detect if they're being run from a bzr checkout
or an extracted release tarball or whatever and adjust PYTHONPATH
accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
"""
23
23
 
24
24
import logging
 
25
import os
 
26
import sys
25
27
from tornado import httpserver
26
28
from tornado import ioloop
27
29
 
 
30
# If ../nova/__init__.py exists, add ../ to Python search path, so that
 
31
# it will override what happens to be installed in /usr/(local/)lib/python...
 
32
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
 
33
                                   os.pardir,
 
34
                                   os.pardir))
 
35
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
 
36
    sys.path.insert(0, possible_topdir)
 
37
 
28
38
from nova import flags
29
39
from nova import server
30
40
from nova import utils