diff options
| author | Shawn O. Pearce <sop@google.com> | 2012-06-05 07:55:07 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2012-06-05 07:56:09 -0700 |
| commit | 4fd38ecc3ae6ce004b59ffe6545918495080e165 (patch) | |
| tree | 130140de974400ce213b76b5814b36b40f819e38 | |
| parent | 9fae805e0421aa4caf1e0a9052f8701a88d7bd0d (diff) | |
| download | git-repo-4fd38ecc3ae6ce004b59ffe6545918495080e165.tar.gz | |
Detect git is not installed
Fix detection for Git not being in $PATH during the initial
run of `repo init` in a new directory.
Change-Id: I2b1fcce1fb8afc47271f5c3bd2a28369009b2fb7
| -rwxr-xr-x | repo | 14 |
1 files changed, 12 insertions, 2 deletions
| @@ -28,7 +28,7 @@ if __name__ == '__main__': | |||
| 28 | del magic | 28 | del magic |
| 29 | 29 | ||
| 30 | # increment this whenever we make important changes to this script | 30 | # increment this whenever we make important changes to this script |
| 31 | VERSION = (1, 16) | 31 | VERSION = (1, 17) |
| 32 | 32 | ||
| 33 | # increment this if the MAINTAINER_KEYS block is modified | 33 | # increment this if the MAINTAINER_KEYS block is modified |
| 34 | KEYRING_VERSION = (1,0) | 34 | KEYRING_VERSION = (1,0) |
| @@ -220,7 +220,17 @@ def _Init(args): | |||
| 220 | 220 | ||
| 221 | def _CheckGitVersion(): | 221 | def _CheckGitVersion(): |
| 222 | cmd = [GIT, '--version'] | 222 | cmd = [GIT, '--version'] |
| 223 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) | 223 | try: |
| 224 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) | ||
| 225 | except OSError, e: | ||
| 226 | print >>sys.stderr | ||
| 227 | print >>sys.stderr, "fatal: '%s' is not available" % GIT | ||
| 228 | print >>sys.stderr, 'fatal: %s' % e | ||
| 229 | print >>sys.stderr | ||
| 230 | print >>sys.stderr, 'Please make sure %s is installed'\ | ||
| 231 | ' and in your path.' % GIT | ||
| 232 | raise CloneFailure() | ||
| 233 | |||
| 224 | ver_str = proc.stdout.read().strip() | 234 | ver_str = proc.stdout.read().strip() |
| 225 | proc.stdout.close() | 235 | proc.stdout.close() |
| 226 | proc.wait() | 236 | proc.wait() |
