285543ac6a
The version checking code fails on Python 2.6 and earlier. `sys.version_info` only became a named tuple in Python 2.7. The recommended way to get the check to work in earlier versions of Python is to access it as a regular tuple.
29 lines
675 B
Python
Executable file
29 lines
675 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sys, os
|
|
|
|
PROJECT_ROOT_DIRECTORY = os.path.dirname(
|
|
os.path.dirname(os.path.realpath(__file__)))
|
|
|
|
def inject(lib_path):
|
|
path = os.path.join(PROJECT_ROOT_DIRECTORY, 'lib', lib_path)
|
|
sys.path.insert(0, path)
|
|
|
|
# version dependent libraries
|
|
if sys.version_info[0] >= 3:
|
|
inject('pyyaml/lib3')
|
|
else:
|
|
inject('pyyaml/lib')
|
|
|
|
if os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'dotbot')):
|
|
if PROJECT_ROOT_DIRECTORY not in sys.path:
|
|
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
|
|
os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY)
|
|
|
|
import dotbot
|
|
|
|
def main():
|
|
dotbot.cli.main()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|