diff options
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 203 |
1 files changed, 100 insertions, 103 deletions
@@ -1,9 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | ## repo default configuration | 3 | ## repo default configuration |
4 | ## | 4 | ## |
5 | REPO_URL='https://gerrit.googlesource.com/git-repo' | 5 | from __future__ import print_function |
6 | REPO_REV='stable' | 6 | REPO_URL = 'https://gerrit.googlesource.com/git-repo' |
7 | REPO_REV = 'stable' | ||
7 | 8 | ||
8 | # Copyright (C) 2008 Google Inc. | 9 | # Copyright (C) 2008 Google Inc. |
9 | # | 10 | # |
@@ -19,19 +20,11 @@ REPO_REV='stable' | |||
19 | # See the License for the specific language governing permissions and | 20 | # See the License for the specific language governing permissions and |
20 | # limitations under the License. | 21 | # limitations under the License. |
21 | 22 | ||
22 | magic='--calling-python-from-/bin/sh--' | ||
23 | """exec" python -E "$0" "$@" """#$magic" | ||
24 | if __name__ == '__main__': | ||
25 | import sys | ||
26 | if sys.argv[-1] == '#%s' % magic: | ||
27 | del sys.argv[-1] | ||
28 | del magic | ||
29 | |||
30 | # increment this whenever we make important changes to this script | 23 | # increment this whenever we make important changes to this script |
31 | VERSION = (1, 18) | 24 | VERSION = (1, 19) |
32 | 25 | ||
33 | # increment this if the MAINTAINER_KEYS block is modified | 26 | # increment this if the MAINTAINER_KEYS block is modified |
34 | KEYRING_VERSION = (1,1) | 27 | KEYRING_VERSION = (1, 1) |
35 | MAINTAINER_KEYS = """ | 28 | MAINTAINER_KEYS = """ |
36 | 29 | ||
37 | Repo Maintainer <repo@android.kernel.org> | 30 | Repo Maintainer <repo@android.kernel.org> |
@@ -110,7 +103,7 @@ V6pfUgqKLWa/aK7/N1ZHnPdFLD8Xt0Dmy4BPwrKC | |||
110 | """ | 103 | """ |
111 | 104 | ||
112 | GIT = 'git' # our git command | 105 | GIT = 'git' # our git command |
113 | MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version | 106 | MIN_GIT_VERSION = (1, 7, 2) # minimum supported git version |
114 | repodir = '.repo' # name of repo's private directory | 107 | repodir = '.repo' # name of repo's private directory |
115 | S_repo = 'repo' # special repo repository | 108 | S_repo = 'repo' # special repo repository |
116 | S_manifests = 'manifests' # special manifest repository | 109 | S_manifests = 'manifests' # special manifest repository |
@@ -120,9 +113,21 @@ REPO_MAIN = S_repo + '/main.py' # main script | |||
120 | import optparse | 113 | import optparse |
121 | import os | 114 | import os |
122 | import re | 115 | import re |
116 | import stat | ||
123 | import subprocess | 117 | import subprocess |
124 | import sys | 118 | import sys |
125 | import urllib2 | 119 | try: |
120 | import urllib2 | ||
121 | except ImportError: | ||
122 | # For python3 | ||
123 | import urllib.request | ||
124 | import urllib.error | ||
125 | else: | ||
126 | # For python2 | ||
127 | import imp | ||
128 | urllib = imp.new_module('urllib') | ||
129 | urllib.request = urllib2 | ||
130 | urllib.error = urllib2 | ||
126 | 131 | ||
127 | home_dot_repo = os.path.expanduser('~/.repoconfig') | 132 | home_dot_repo = os.path.expanduser('~/.repoconfig') |
128 | gpg_dir = os.path.join(home_dot_repo, 'gnupg') | 133 | gpg_dir = os.path.join(home_dot_repo, 'gnupg') |
@@ -149,7 +154,8 @@ group.add_option('-m', '--manifest-name', | |||
149 | help='initial manifest file', metavar='NAME.xml') | 154 | help='initial manifest file', metavar='NAME.xml') |
150 | group.add_option('--mirror', | 155 | group.add_option('--mirror', |
151 | dest='mirror', action='store_true', | 156 | dest='mirror', action='store_true', |
152 | help='mirror the forrest') | 157 | help='create a replica of the remote repositories ' |
158 | 'rather than a client working directory') | ||
153 | group.add_option('--reference', | 159 | group.add_option('--reference', |
154 | dest='reference', | 160 | dest='reference', |
155 | help='location of mirror directory', metavar='DIR') | 161 | help='location of mirror directory', metavar='DIR') |
@@ -211,17 +217,16 @@ def _Init(args): | |||
211 | if branch.startswith('refs/heads/'): | 217 | if branch.startswith('refs/heads/'): |
212 | branch = branch[len('refs/heads/'):] | 218 | branch = branch[len('refs/heads/'):] |
213 | if branch.startswith('refs/'): | 219 | if branch.startswith('refs/'): |
214 | print >>sys.stderr, "fatal: invalid branch name '%s'" % branch | 220 | print("fatal: invalid branch name '%s'" % branch, file=sys.stderr) |
215 | raise CloneFailure() | 221 | raise CloneFailure() |
216 | 222 | ||
217 | if not os.path.isdir(repodir): | 223 | if not os.path.isdir(repodir): |
218 | try: | 224 | try: |
219 | os.mkdir(repodir) | 225 | os.mkdir(repodir) |
220 | except OSError as e: | 226 | except OSError as e: |
221 | print >>sys.stderr, \ | 227 | print('fatal: cannot make %s directory: %s' |
222 | 'fatal: cannot make %s directory: %s' % ( | 228 | % (repodir, e.strerror), file=sys.stderr) |
223 | repodir, e.strerror) | 229 | # Don't raise CloneFailure; that would delete the |
224 | # Don't faise CloneFailure; that would delete the | ||
225 | # name. Instead exit immediately. | 230 | # name. Instead exit immediately. |
226 | # | 231 | # |
227 | sys.exit(1) | 232 | sys.exit(1) |
@@ -244,8 +249,8 @@ def _Init(args): | |||
244 | _Checkout(dst, branch, rev, opt.quiet) | 249 | _Checkout(dst, branch, rev, opt.quiet) |
245 | except CloneFailure: | 250 | except CloneFailure: |
246 | if opt.quiet: | 251 | if opt.quiet: |
247 | print >>sys.stderr, \ | 252 | print('fatal: repo init failed; run without --quiet to see why', |
248 | 'fatal: repo init failed; run without --quiet to see why' | 253 | file=sys.stderr) |
249 | raise | 254 | raise |
250 | 255 | ||
251 | 256 | ||
@@ -254,12 +259,12 @@ def _CheckGitVersion(): | |||
254 | try: | 259 | try: |
255 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) | 260 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |
256 | except OSError as e: | 261 | except OSError as e: |
257 | print >>sys.stderr | 262 | print(file=sys.stderr) |
258 | print >>sys.stderr, "fatal: '%s' is not available" % GIT | 263 | print("fatal: '%s' is not available" % GIT, file=sys.stderr) |
259 | print >>sys.stderr, 'fatal: %s' % e | 264 | print('fatal: %s' % e, file=sys.stderr) |
260 | print >>sys.stderr | 265 | print(file=sys.stderr) |
261 | print >>sys.stderr, 'Please make sure %s is installed'\ | 266 | print('Please make sure %s is installed and in your path.' % GIT, |
262 | ' and in your path.' % GIT | 267 | file=sys.stderr) |
263 | raise CloneFailure() | 268 | raise CloneFailure() |
264 | 269 | ||
265 | ver_str = proc.stdout.read().strip() | 270 | ver_str = proc.stdout.read().strip() |
@@ -267,14 +272,14 @@ def _CheckGitVersion(): | |||
267 | proc.wait() | 272 | proc.wait() |
268 | 273 | ||
269 | if not ver_str.startswith('git version '): | 274 | if not ver_str.startswith('git version '): |
270 | print >>sys.stderr, 'error: "%s" unsupported' % ver_str | 275 | print('error: "%s" unsupported' % ver_str, file=sys.stderr) |
271 | raise CloneFailure() | 276 | raise CloneFailure() |
272 | 277 | ||
273 | ver_str = ver_str[len('git version '):].strip() | 278 | ver_str = ver_str[len('git version '):].strip() |
274 | ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3])) | 279 | ver_act = tuple(map(int, ver_str.split('.')[0:3])) |
275 | if ver_act < MIN_GIT_VERSION: | 280 | if ver_act < MIN_GIT_VERSION: |
276 | need = '.'.join(map(lambda x: str(x), MIN_GIT_VERSION)) | 281 | need = '.'.join(map(str, MIN_GIT_VERSION)) |
277 | print >>sys.stderr, 'fatal: git %s or later required' % need | 282 | print('fatal: git %s or later required' % need, file=sys.stderr) |
278 | raise CloneFailure() | 283 | raise CloneFailure() |
279 | 284 | ||
280 | 285 | ||
@@ -290,7 +295,7 @@ def NeedSetupGnuPG(): | |||
290 | if not kv: | 295 | if not kv: |
291 | return True | 296 | return True |
292 | 297 | ||
293 | kv = tuple(map(lambda x: int(x), kv.split('.'))) | 298 | kv = tuple(map(int, kv.split('.'))) |
294 | if kv < KEYRING_VERSION: | 299 | if kv < KEYRING_VERSION: |
295 | return True | 300 | return True |
296 | return False | 301 | return False |
@@ -301,18 +306,16 @@ def SetupGnuPG(quiet): | |||
301 | try: | 306 | try: |
302 | os.mkdir(home_dot_repo) | 307 | os.mkdir(home_dot_repo) |
303 | except OSError as e: | 308 | except OSError as e: |
304 | print >>sys.stderr, \ | 309 | print('fatal: cannot make %s directory: %s' |
305 | 'fatal: cannot make %s directory: %s' % ( | 310 | % (home_dot_repo, e.strerror), file=sys.stderr) |
306 | home_dot_repo, e.strerror) | ||
307 | sys.exit(1) | 311 | sys.exit(1) |
308 | 312 | ||
309 | if not os.path.isdir(gpg_dir): | 313 | if not os.path.isdir(gpg_dir): |
310 | try: | 314 | try: |
311 | os.mkdir(gpg_dir, 0700) | 315 | os.mkdir(gpg_dir, stat.S_IRWXU) |
312 | except OSError as e: | 316 | except OSError as e: |
313 | print >>sys.stderr, \ | 317 | print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror), |
314 | 'fatal: cannot make %s directory: %s' % ( | 318 | file=sys.stderr) |
315 | gpg_dir, e.strerror) | ||
316 | sys.exit(1) | 319 | sys.exit(1) |
317 | 320 | ||
318 | env = os.environ.copy() | 321 | env = os.environ.copy() |
@@ -325,21 +328,21 @@ def SetupGnuPG(quiet): | |||
325 | stdin = subprocess.PIPE) | 328 | stdin = subprocess.PIPE) |
326 | except OSError as e: | 329 | except OSError as e: |
327 | if not quiet: | 330 | if not quiet: |
328 | print >>sys.stderr, 'warning: gpg (GnuPG) is not available.' | 331 | print('warning: gpg (GnuPG) is not available.', file=sys.stderr) |
329 | print >>sys.stderr, 'warning: Installing it is strongly encouraged.' | 332 | print('warning: Installing it is strongly encouraged.', file=sys.stderr) |
330 | print >>sys.stderr | 333 | print(file=sys.stderr) |
331 | return False | 334 | return False |
332 | 335 | ||
333 | proc.stdin.write(MAINTAINER_KEYS) | 336 | proc.stdin.write(MAINTAINER_KEYS) |
334 | proc.stdin.close() | 337 | proc.stdin.close() |
335 | 338 | ||
336 | if proc.wait() != 0: | 339 | if proc.wait() != 0: |
337 | print >>sys.stderr, 'fatal: registering repo maintainer keys failed' | 340 | print('fatal: registering repo maintainer keys failed', file=sys.stderr) |
338 | sys.exit(1) | 341 | sys.exit(1) |
339 | 342 | print() | |
340 | 343 | ||
341 | fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w') | 344 | fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w') |
342 | fd.write('.'.join(map(lambda x: str(x), KEYRING_VERSION)) + '\n') | 345 | fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n') |
343 | fd.close() | 346 | fd.close() |
344 | return True | 347 | return True |
345 | 348 | ||
@@ -355,7 +358,7 @@ def _SetConfig(local, name, value): | |||
355 | def _InitHttp(): | 358 | def _InitHttp(): |
356 | handlers = [] | 359 | handlers = [] |
357 | 360 | ||
358 | mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() | 361 | mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() |
359 | try: | 362 | try: |
360 | import netrc | 363 | import netrc |
361 | n = netrc.netrc() | 364 | n = netrc.netrc() |
@@ -365,20 +368,20 @@ def _InitHttp(): | |||
365 | mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2]) | 368 | mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2]) |
366 | except: | 369 | except: |
367 | pass | 370 | pass |
368 | handlers.append(urllib2.HTTPBasicAuthHandler(mgr)) | 371 | handlers.append(urllib.request.HTTPBasicAuthHandler(mgr)) |
369 | handlers.append(urllib2.HTTPDigestAuthHandler(mgr)) | 372 | handlers.append(urllib.request.HTTPDigestAuthHandler(mgr)) |
370 | 373 | ||
371 | if 'http_proxy' in os.environ: | 374 | if 'http_proxy' in os.environ: |
372 | url = os.environ['http_proxy'] | 375 | url = os.environ['http_proxy'] |
373 | handlers.append(urllib2.ProxyHandler({'http': url, 'https': url})) | 376 | handlers.append(urllib.request.ProxyHandler({'http': url, 'https': url})) |
374 | if 'REPO_CURL_VERBOSE' in os.environ: | 377 | if 'REPO_CURL_VERBOSE' in os.environ: |
375 | handlers.append(urllib2.HTTPHandler(debuglevel=1)) | 378 | handlers.append(urllib.request.HTTPHandler(debuglevel=1)) |
376 | handlers.append(urllib2.HTTPSHandler(debuglevel=1)) | 379 | handlers.append(urllib.request.HTTPSHandler(debuglevel=1)) |
377 | urllib2.install_opener(urllib2.build_opener(*handlers)) | 380 | urllib.request.install_opener(urllib.request.build_opener(*handlers)) |
378 | 381 | ||
379 | def _Fetch(url, local, src, quiet): | 382 | def _Fetch(url, local, src, quiet): |
380 | if not quiet: | 383 | if not quiet: |
381 | print >>sys.stderr, 'Get %s' % url | 384 | print('Get %s' % url, file=sys.stderr) |
382 | 385 | ||
383 | cmd = [GIT, 'fetch'] | 386 | cmd = [GIT, 'fetch'] |
384 | if quiet: | 387 | if quiet: |
@@ -423,20 +426,20 @@ def _DownloadBundle(url, local, quiet): | |||
423 | dest = open(os.path.join(local, '.git', 'clone.bundle'), 'w+b') | 426 | dest = open(os.path.join(local, '.git', 'clone.bundle'), 'w+b') |
424 | try: | 427 | try: |
425 | try: | 428 | try: |
426 | r = urllib2.urlopen(url) | 429 | r = urllib.request.urlopen(url) |
427 | except urllib2.HTTPError as e: | 430 | except urllib.error.HTTPError as e: |
428 | if e.code == 404: | 431 | if e.code in [403, 404]: |
429 | return False | 432 | return False |
430 | print >>sys.stderr, 'fatal: Cannot get %s' % url | 433 | print('fatal: Cannot get %s' % url, file=sys.stderr) |
431 | print >>sys.stderr, 'fatal: HTTP error %s' % e.code | 434 | print('fatal: HTTP error %s' % e.code, file=sys.stderr) |
432 | raise CloneFailure() | 435 | raise CloneFailure() |
433 | except urllib2.URLError as e: | 436 | except urllib.error.URLError as e: |
434 | print >>sys.stderr, 'fatal: Cannot get %s' % url | 437 | print('fatal: Cannot get %s' % url, file=sys.stderr) |
435 | print >>sys.stderr, 'fatal: error %s' % e.reason | 438 | print('fatal: error %s' % e.reason, file=sys.stderr) |
436 | raise CloneFailure() | 439 | raise CloneFailure() |
437 | try: | 440 | try: |
438 | if not quiet: | 441 | if not quiet: |
439 | print >>sys.stderr, 'Get %s' % url | 442 | print('Get %s' % url, file=sys.stderr) |
440 | while True: | 443 | while True: |
441 | buf = r.read(8192) | 444 | buf = r.read(8192) |
442 | if buf == '': | 445 | if buf == '': |
@@ -460,24 +463,23 @@ def _Clone(url, local, quiet): | |||
460 | try: | 463 | try: |
461 | os.mkdir(local) | 464 | os.mkdir(local) |
462 | except OSError as e: | 465 | except OSError as e: |
463 | print >>sys.stderr, \ | 466 | print('fatal: cannot make %s directory: %s' % (local, e.strerror), |
464 | 'fatal: cannot make %s directory: %s' \ | 467 | file=sys.stderr) |
465 | % (local, e.strerror) | ||
466 | raise CloneFailure() | 468 | raise CloneFailure() |
467 | 469 | ||
468 | cmd = [GIT, 'init', '--quiet'] | 470 | cmd = [GIT, 'init', '--quiet'] |
469 | try: | 471 | try: |
470 | proc = subprocess.Popen(cmd, cwd = local) | 472 | proc = subprocess.Popen(cmd, cwd = local) |
471 | except OSError as e: | 473 | except OSError as e: |
472 | print >>sys.stderr | 474 | print(file=sys.stderr) |
473 | print >>sys.stderr, "fatal: '%s' is not available" % GIT | 475 | print("fatal: '%s' is not available" % GIT, file=sys.stderr) |
474 | print >>sys.stderr, 'fatal: %s' % e | 476 | print('fatal: %s' % e, file=sys.stderr) |
475 | print >>sys.stderr | 477 | print(file=sys.stderr) |
476 | print >>sys.stderr, 'Please make sure %s is installed'\ | 478 | print('Please make sure %s is installed and in your path.' % GIT, |
477 | ' and in your path.' % GIT | 479 | file=sys.stderr) |
478 | raise CloneFailure() | 480 | raise CloneFailure() |
479 | if proc.wait() != 0: | 481 | if proc.wait() != 0: |
480 | print >>sys.stderr, 'fatal: could not create %s' % local | 482 | print('fatal: could not create %s' % local, file=sys.stderr) |
481 | raise CloneFailure() | 483 | raise CloneFailure() |
482 | 484 | ||
483 | _InitHttp() | 485 | _InitHttp() |
@@ -505,21 +507,18 @@ def _Verify(cwd, branch, quiet): | |||
505 | proc.stderr.close() | 507 | proc.stderr.close() |
506 | 508 | ||
507 | if proc.wait() != 0 or not cur: | 509 | if proc.wait() != 0 or not cur: |
508 | print >>sys.stderr | 510 | print(file=sys.stderr) |
509 | print >>sys.stderr,\ | 511 | print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr) |
510 | "fatal: branch '%s' has not been signed" \ | ||
511 | % branch | ||
512 | raise CloneFailure() | 512 | raise CloneFailure() |
513 | 513 | ||
514 | m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur) | 514 | m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur) |
515 | if m: | 515 | if m: |
516 | cur = m.group(1) | 516 | cur = m.group(1) |
517 | if not quiet: | 517 | if not quiet: |
518 | print >>sys.stderr | 518 | print(file=sys.stderr) |
519 | print >>sys.stderr, \ | 519 | print("info: Ignoring branch '%s'; using tagged release '%s'" |
520 | "info: Ignoring branch '%s'; using tagged release '%s'" \ | 520 | % (branch, cur), file=sys.stderr) |
521 | % (branch, cur) | 521 | print(file=sys.stderr) |
522 | print >>sys.stderr | ||
523 | 522 | ||
524 | env = os.environ.copy() | 523 | env = os.environ.copy() |
525 | env['GNUPGHOME'] = gpg_dir.encode() | 524 | env['GNUPGHOME'] = gpg_dir.encode() |
@@ -537,10 +536,10 @@ def _Verify(cwd, branch, quiet): | |||
537 | proc.stderr.close() | 536 | proc.stderr.close() |
538 | 537 | ||
539 | if proc.wait() != 0: | 538 | if proc.wait() != 0: |
540 | print >>sys.stderr | 539 | print(file=sys.stderr) |
541 | print >>sys.stderr, out | 540 | print(out, file=sys.stderr) |
542 | print >>sys.stderr, err | 541 | print(err, file=sys.stderr) |
543 | print >>sys.stderr | 542 | print(file=sys.stderr) |
544 | raise CloneFailure() | 543 | raise CloneFailure() |
545 | return '%s^0' % cur | 544 | return '%s^0' % cur |
546 | 545 | ||
@@ -594,7 +593,7 @@ def _ParseArguments(args): | |||
594 | opt = _Options() | 593 | opt = _Options() |
595 | arg = [] | 594 | arg = [] |
596 | 595 | ||
597 | for i in xrange(0, len(args)): | 596 | for i in range(len(args)): |
598 | a = args[i] | 597 | a = args[i] |
599 | if a == '-h' or a == '--help': | 598 | if a == '-h' or a == '--help': |
600 | opt.help = True | 599 | opt.help = True |
@@ -607,7 +606,7 @@ def _ParseArguments(args): | |||
607 | 606 | ||
608 | 607 | ||
609 | def _Usage(): | 608 | def _Usage(): |
610 | print >>sys.stderr,\ | 609 | print( |
611 | """usage: repo COMMAND [ARGS] | 610 | """usage: repo COMMAND [ARGS] |
612 | 611 | ||
613 | repo is not yet installed. Use "repo init" to install it here. | 612 | repo is not yet installed. Use "repo init" to install it here. |
@@ -618,7 +617,7 @@ The most commonly used repo commands are: | |||
618 | help Display detailed help on a command | 617 | help Display detailed help on a command |
619 | 618 | ||
620 | For access to the full online help, install repo ("repo init"). | 619 | For access to the full online help, install repo ("repo init"). |
621 | """ | 620 | """, file=sys.stderr) |
622 | sys.exit(1) | 621 | sys.exit(1) |
623 | 622 | ||
624 | 623 | ||
@@ -628,25 +627,23 @@ def _Help(args): | |||
628 | init_optparse.print_help() | 627 | init_optparse.print_help() |
629 | sys.exit(0) | 628 | sys.exit(0) |
630 | else: | 629 | else: |
631 | print >>sys.stderr,\ | 630 | print("error: '%s' is not a bootstrap command.\n" |
632 | "error: '%s' is not a bootstrap command.\n"\ | 631 | ' For access to online help, install repo ("repo init").' |
633 | ' For access to online help, install repo ("repo init").'\ | 632 | % args[0], file=sys.stderr) |
634 | % args[0] | ||
635 | else: | 633 | else: |
636 | _Usage() | 634 | _Usage() |
637 | sys.exit(1) | 635 | sys.exit(1) |
638 | 636 | ||
639 | 637 | ||
640 | def _NotInstalled(): | 638 | def _NotInstalled(): |
641 | print >>sys.stderr,\ | 639 | print('error: repo is not installed. Use "repo init" to install it here.', |
642 | 'error: repo is not installed. Use "repo init" to install it here.' | 640 | file=sys.stderr) |
643 | sys.exit(1) | 641 | sys.exit(1) |
644 | 642 | ||
645 | 643 | ||
646 | def _NoCommands(cmd): | 644 | def _NoCommands(cmd): |
647 | print >>sys.stderr,\ | 645 | print("""error: command '%s' requires repo to be installed first. |
648 | """error: command '%s' requires repo to be installed first. | 646 | Use "repo init" to install it here.""" % cmd, file=sys.stderr) |
649 | Use "repo init" to install it here.""" % cmd | ||
650 | sys.exit(1) | 647 | sys.exit(1) |
651 | 648 | ||
652 | 649 | ||
@@ -683,7 +680,7 @@ def _SetDefaultsTo(gitdir): | |||
683 | proc.stderr.close() | 680 | proc.stderr.close() |
684 | 681 | ||
685 | if proc.wait() != 0: | 682 | if proc.wait() != 0: |
686 | print >>sys.stderr, 'fatal: %s has no current branch' % gitdir | 683 | print('fatal: %s has no current branch' % gitdir, file=sys.stderr) |
687 | sys.exit(1) | 684 | sys.exit(1) |
688 | 685 | ||
689 | 686 | ||
@@ -721,7 +718,7 @@ def main(orig_args): | |||
721 | if my_main: | 718 | if my_main: |
722 | repo_main = my_main | 719 | repo_main = my_main |
723 | 720 | ||
724 | ver_str = '.'.join(map(lambda x: str(x), VERSION)) | 721 | ver_str = '.'.join(map(str, VERSION)) |
725 | me = [repo_main, | 722 | me = [repo_main, |
726 | '--repo-dir=%s' % rel_repo_dir, | 723 | '--repo-dir=%s' % rel_repo_dir, |
727 | '--wrapper-version=%s' % ver_str, | 724 | '--wrapper-version=%s' % ver_str, |
@@ -732,8 +729,8 @@ def main(orig_args): | |||
732 | try: | 729 | try: |
733 | os.execv(repo_main, me) | 730 | os.execv(repo_main, me) |
734 | except OSError as e: | 731 | except OSError as e: |
735 | print >>sys.stderr, "fatal: unable to start %s" % repo_main | 732 | print("fatal: unable to start %s" % repo_main, file=sys.stderr) |
736 | print >>sys.stderr, "fatal: %s" % e | 733 | print("fatal: %s" % e, file=sys.stderr) |
737 | sys.exit(148) | 734 | sys.exit(148) |
738 | 735 | ||
739 | 736 | ||