fix_pythonpath.py 539 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # Copyright (c) 2014 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Add the checkout root to sys.path, provide mechanisms for adding others."""
  6. import os
  7. import sys
  8. CHECKOUT_ROOT = os.path.realpath(os.path.join(
  9. os.path.dirname(os.path.abspath(__file__)), os.pardir))
  10. def add_to_pythonpath(path):
  11. """Add the given directory to PYTHONPATH."""
  12. sys.path.append(path)
  13. add_to_pythonpath(CHECKOUT_ROOT)