diff options
author | Eric Boren <borenet@google.com> | 2014-06-25 11:13:27 -0400 |
---|---|---|
committer | Eric Boren <borenet@google.com> | 2014-06-25 11:13:27 -0400 |
commit | bb0ef0a1345671f94950bd0a405399954db21d97 (patch) | |
tree | b56bf26a017e4c9246973f878545379158249f12 /tools/fix_pythonpath.py | |
parent | 55106da359ba8cdff0e4e1f9561aff3b7fb4bb47 (diff) |
Use new common tools in Python scripts
BUG=skia:2682
R=rmistry@google.com
Review URL: https://codereview.chromium.org/330423004
Diffstat (limited to 'tools/fix_pythonpath.py')
-rw-r--r-- | tools/fix_pythonpath.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/fix_pythonpath.py b/tools/fix_pythonpath.py new file mode 100644 index 0000000000..c84738ac85 --- /dev/null +++ b/tools/fix_pythonpath.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# Copyright (c) 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Add the checkout root to sys.path, provide mechanisms for adding others.""" + + +import os +import sys + + +CHECKOUT_ROOT = os.path.realpath(os.path.join( + os.path.dirname(os.path.abspath(__file__)), os.pardir)) + + +def add_to_pythonpath(path): + """Add the given directory to PYTHONPATH.""" + sys.path.append(path) + + +add_to_pythonpath(CHECKOUT_ROOT) + |