1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/bin/cfx Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +#! /usr/bin/env python 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 + 1.10 +import os 1.11 +import sys 1.12 + 1.13 +# set the cuddlefish "root directory" for this process if it's not already 1.14 +# set in the environment 1.15 +cuddlefish_root = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))) 1.16 + 1.17 +if 'CUDDLEFISH_ROOT' not in os.environ: 1.18 + os.environ['CUDDLEFISH_ROOT'] = cuddlefish_root 1.19 + 1.20 +# add our own python-lib path to the python module search path. 1.21 +python_lib_dir = os.path.join(cuddlefish_root, "python-lib") 1.22 +if python_lib_dir not in sys.path: 1.23 + sys.path.insert(0, python_lib_dir) 1.24 + 1.25 +# now export to env so sub-processes get it too 1.26 +if 'PYTHONPATH' not in os.environ: 1.27 + os.environ['PYTHONPATH'] = python_lib_dir 1.28 +elif python_lib_dir not in os.environ['PYTHONPATH'].split(os.pathsep): 1.29 + paths = os.environ['PYTHONPATH'].split(os.pathsep) 1.30 + paths.insert(0, python_lib_dir) 1.31 + os.environ['PYTHONPATH'] = os.pathsep.join(paths) 1.32 + 1.33 +import cuddlefish 1.34 + 1.35 +if __name__ == '__main__': 1.36 + cuddlefish.run()