Index: bin/chromite |
diff --git a/bin/chromite b/bin/chromite |
index b632b610b038b9127d39283d5ef44923f2c002d4..48b09070c3b658c8867ce211d73e0bd987606234 100755 |
--- a/bin/chromite |
+++ b/bin/chromite |
@@ -30,19 +30,23 @@ import sys |
def Search(path): |
"""Return an iterator of lists of places to look for chromite.""" |
- # Look in $CROS_WORKON_SRCROOT first. |
- if 'CROS_WORKON_SRCROOT' in os.environ: |
- yield [os.environ['CROS_WORKON_SRCROOT']] |
+ if os.path.exists('/etc/debian_chroot'): |
+ # We're in the chroot. Chromite should be in the python path inside the |
+ # chroot, so we don't do any searching. NOTE that we purposely don't want |
+ # CROS_WORKON_SRCROOT in the python path. |
+ yield [] |
+ else: |
+ # Look in $CROS_WORKON_SRCROOT first. The idea is that a user would set |
+ # this manually if they wanted to specify a particular version of chromite. |
+ if 'CROS_WORKON_SRCROOT' in os.environ: |
+ yield [os.environ['CROS_WORKON_SRCROOT']] |
- # Try the path as is |
- yield [] |
- |
- # Search upward until we either end up with a blank dir or the "parent" dir |
- # doesn't change. |
- prev_path = None |
- while path and path != prev_path: |
- yield [path] |
- path, prev_path = os.path.dirname(path), path |
+ # Search upward until we either end up with a blank dir or the "parent" dir |
+ # doesn't change. |
+ prev_path = None |
+ while path and path != prev_path: |
+ yield [path] |
+ path, prev_path = os.path.dirname(path), path |
for path in Search(os.getcwd()): |