| Index: scripts/bootstrap/frog_wrapper.py
|
| ===================================================================
|
| --- scripts/bootstrap/frog_wrapper.py (revision 1140)
|
| +++ scripts/bootstrap/frog_wrapper.py (working copy)
|
| @@ -3,19 +3,34 @@
|
| # for details. All rights reserved. Use of this source code is governed by a
|
| # BSD-style license that can be found in the LICENSE file.
|
|
|
| +import imp
|
| import os
|
| import sys
|
|
|
| -HOME = os.path.dirname(os.path.realpath(__file__))
|
| -# TODO(ngeoffray): does not work on Windows.
|
| -HOME = os.path.join(HOME, os.pardir, os.pardir)
|
| +def main(args):
|
| + # Try to find frog.py from the current location.
|
| + home = os.path.join(os.curdir, 'frog.py')
|
| + if not os.path.exists(home):
|
| + home = os.path.join(os.curdir, 'frog', 'frog.py')
|
|
|
| -sys.path.append(HOME)
|
| -import frog
|
| + if not os.path.exists(home):
|
| + print "Could not find frog"
|
| + return 1
|
|
|
| -def main(args):
|
| - return frog.main(args)
|
| + filename = None
|
| + exit_code = 1
|
| + try:
|
| + # Load frog.py and invoke it.
|
| + paths = [os.path.dirname(home)]
|
| + (filename, pathname, description) = imp.find_module('frog', paths)
|
| + module = imp.load_module('frog', filename, pathname, description)
|
| + exit_code = module.main(args)
|
| + finally:
|
| + if filename:
|
| + filename.close()
|
|
|
| + return exit_code
|
|
|
| +
|
| if __name__ == '__main__':
|
| sys.exit(main(sys.argv))
|
|
|