Initial import to Tizen
[profile/ivi/python-twisted.git] / bin / _preamble.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 # This makes sure that users don't have to set up their environment
5 # specially in order to run these programs from bin/.
6
7 # This helper is shared by many different actual scripts.  It is not intended to
8 # be packaged or installed, it is only a developer convenience.  By the time
9 # Twisted is actually installed somewhere, the environment should already be set
10 # up properly without the help of this tool.
11
12 import sys, os
13
14 path = os.path.abspath(sys.argv[0])
15 while os.path.dirname(path) != path:
16     if os.path.exists(os.path.join(path, 'twisted', '__init__.py')):
17         sys.path.insert(0, path)
18         break
19     path = os.path.dirname(path)