| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2014 Google Inc. | 4 Copyright 2014 Google Inc. |
| 5 | 5 |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 Adds [trunk]/gm and [trunk]/tools to PYTHONPATH, if they aren't already there. | 9 Adds possibly-needed directories to PYTHONPATH, if they aren't already there. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import os | 12 import os |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | 15 TRUNK_DIRECTORY = os.path.abspath(os.path.join( |
| 16 GM_DIRECTORY = os.path.join(TRUNK_DIRECTORY, 'gm') | 16 os.path.dirname(__file__), os.pardir, os.pardir)) |
| 17 TOOLS_DIRECTORY = os.path.join(TRUNK_DIRECTORY, 'tools') | 17 for subdir in ['common', 'gm', 'tools']: |
| 18 if GM_DIRECTORY not in sys.path: | 18 fullpath = os.path.join(TRUNK_DIRECTORY, subdir) |
| 19 sys.path.append(GM_DIRECTORY) | 19 if fullpath not in sys.path: |
| 20 if TOOLS_DIRECTORY not in sys.path: | 20 sys.path.append(fullpath) |
| 21 sys.path.append(TOOLS_DIRECTORY) | |
| OLD | NEW |