diff options
| author | Mike Frysinger <vapier@google.com> | 2019-06-13 01:14:23 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-06-13 14:31:45 +0000 |
| commit | c92ce5c7dc079bcc18a227d39fc2b3eaa134354d (patch) | |
| tree | 3c438178672cf7f29e37a6ebbc8b5c6021ef7ca9 | |
| parent | f601376e13e6beca7ab8d660e00d6c14714f305f (diff) | |
| download | git-repo-c92ce5c7dc079bcc18a227d39fc2b3eaa134354d.tar.gz | |
repo: restore use of print_function
We avoided this future import because Python 2.4 & 2.5 did not
support it. We've dropped support for Python 2.6 at this point,
and those versions are long dead. Since this workaround adds a
bit of complexity to the codebase, drop it. Considering we are
not running any actual tests against older versions, there's no
sense in trying to support them anymore.
Change-Id: Icda874861e8a8eb4fa07c624a9e7c5ee2a0da401
| -rwxr-xr-x | repo | 169 |
1 files changed, 80 insertions, 89 deletions
| @@ -1,6 +1,8 @@ | |||
| 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
| 2 | # -*- coding:utf-8 -*- | 2 | # -*- coding:utf-8 -*- |
| 3 | 3 | ||
| 4 | from __future__ import print_function | ||
| 5 | |||
| 4 | # repo default configuration | 6 | # repo default configuration |
| 5 | # | 7 | # |
| 6 | import os | 8 | import os |
| @@ -139,26 +141,15 @@ else: | |||
| 139 | urllib.error = urllib2 | 141 | urllib.error = urllib2 |
| 140 | 142 | ||
| 141 | 143 | ||
| 142 | def _print(*objects, **kwargs): | ||
| 143 | sep = kwargs.get('sep', ' ') | ||
| 144 | end = kwargs.get('end', '\n') | ||
| 145 | out = kwargs.get('file', sys.stdout) | ||
| 146 | out.write(sep.join(objects) + end) | ||
| 147 | |||
| 148 | # On Windows stderr is buffered, so flush to maintain the order of error messages. | ||
| 149 | if out == sys.stderr and platform.system() == "Windows": | ||
| 150 | out.flush() | ||
| 151 | |||
| 152 | |||
| 153 | # Python version check | 144 | # Python version check |
| 154 | ver = sys.version_info | 145 | ver = sys.version_info |
| 155 | if (ver[0], ver[1]) < MIN_PYTHON_VERSION: | 146 | if (ver[0], ver[1]) < MIN_PYTHON_VERSION: |
| 156 | _print('error: Python version {} unsupported.\n' | 147 | print('error: Python version {} unsupported.\n' |
| 157 | 'Please use Python {}.{} instead.'.format( | 148 | 'Please use Python {}.{} instead.'.format( |
| 158 | sys.version.split(' ')[0], | 149 | sys.version.split(' ')[0], |
| 159 | MIN_PYTHON_VERSION[0], | 150 | MIN_PYTHON_VERSION[0], |
| 160 | MIN_PYTHON_VERSION[1], | 151 | MIN_PYTHON_VERSION[1], |
| 161 | ), file=sys.stderr) | 152 | ), file=sys.stderr) |
| 162 | sys.exit(1) | 153 | sys.exit(1) |
| 163 | 154 | ||
| 164 | home_dot_repo = os.path.expanduser('~/.repoconfig') | 155 | home_dot_repo = os.path.expanduser('~/.repoconfig') |
| @@ -324,21 +315,21 @@ def _Init(args, gitc_init=False): | |||
| 324 | if branch.startswith('refs/heads/'): | 315 | if branch.startswith('refs/heads/'): |
| 325 | branch = branch[len('refs/heads/'):] | 316 | branch = branch[len('refs/heads/'):] |
| 326 | if branch.startswith('refs/'): | 317 | if branch.startswith('refs/'): |
| 327 | _print("fatal: invalid branch name '%s'" % branch, file=sys.stderr) | 318 | print("fatal: invalid branch name '%s'" % branch, file=sys.stderr) |
| 328 | raise CloneFailure() | 319 | raise CloneFailure() |
| 329 | 320 | ||
| 330 | try: | 321 | try: |
| 331 | if gitc_init: | 322 | if gitc_init: |
| 332 | gitc_manifest_dir = get_gitc_manifest_dir() | 323 | gitc_manifest_dir = get_gitc_manifest_dir() |
| 333 | if not gitc_manifest_dir: | 324 | if not gitc_manifest_dir: |
| 334 | _print('fatal: GITC filesystem is not available. Exiting...', | 325 | print('fatal: GITC filesystem is not available. Exiting...', |
| 335 | file=sys.stderr) | 326 | file=sys.stderr) |
| 336 | sys.exit(1) | 327 | sys.exit(1) |
| 337 | gitc_client = opt.gitc_client | 328 | gitc_client = opt.gitc_client |
| 338 | if not gitc_client: | 329 | if not gitc_client: |
| 339 | gitc_client = gitc_parse_clientdir(os.getcwd()) | 330 | gitc_client = gitc_parse_clientdir(os.getcwd()) |
| 340 | if not gitc_client: | 331 | if not gitc_client: |
| 341 | _print('fatal: GITC client (-c) is required.', file=sys.stderr) | 332 | print('fatal: GITC client (-c) is required.', file=sys.stderr) |
| 342 | sys.exit(1) | 333 | sys.exit(1) |
| 343 | client_dir = os.path.join(gitc_manifest_dir, gitc_client) | 334 | client_dir = os.path.join(gitc_manifest_dir, gitc_client) |
| 344 | if not os.path.exists(client_dir): | 335 | if not os.path.exists(client_dir): |
| @@ -351,8 +342,8 @@ def _Init(args, gitc_init=False): | |||
| 351 | os.mkdir(repodir) | 342 | os.mkdir(repodir) |
| 352 | except OSError as e: | 343 | except OSError as e: |
| 353 | if e.errno != errno.EEXIST: | 344 | if e.errno != errno.EEXIST: |
| 354 | _print('fatal: cannot make %s directory: %s' | 345 | print('fatal: cannot make %s directory: %s' |
| 355 | % (repodir, e.strerror), file=sys.stderr) | 346 | % (repodir, e.strerror), file=sys.stderr) |
| 356 | # Don't raise CloneFailure; that would delete the | 347 | # Don't raise CloneFailure; that would delete the |
| 357 | # name. Instead exit immediately. | 348 | # name. Instead exit immediately. |
| 358 | # | 349 | # |
| @@ -376,13 +367,13 @@ def _Init(args, gitc_init=False): | |||
| 376 | _Checkout(dst, branch, rev, opt.quiet) | 367 | _Checkout(dst, branch, rev, opt.quiet) |
| 377 | 368 | ||
| 378 | if not os.path.isfile(os.path.join(dst, 'repo')): | 369 | if not os.path.isfile(os.path.join(dst, 'repo')): |
| 379 | _print("warning: '%s' does not look like a git-repo repository, is " | 370 | print("warning: '%s' does not look like a git-repo repository, is " |
| 380 | "REPO_URL set correctly?" % url, file=sys.stderr) | 371 | "REPO_URL set correctly?" % url, file=sys.stderr) |
| 381 | 372 | ||
| 382 | except CloneFailure: | 373 | except CloneFailure: |
| 383 | if opt.quiet: | 374 | if opt.quiet: |
| 384 | _print('fatal: repo init failed; run without --quiet to see why', | 375 | print('fatal: repo init failed; run without --quiet to see why', |
| 385 | file=sys.stderr) | 376 | file=sys.stderr) |
| 386 | raise | 377 | raise |
| 387 | 378 | ||
| 388 | 379 | ||
| @@ -405,12 +396,12 @@ def _CheckGitVersion(): | |||
| 405 | try: | 396 | try: |
| 406 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) | 397 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) |
| 407 | except OSError as e: | 398 | except OSError as e: |
| 408 | _print(file=sys.stderr) | 399 | print(file=sys.stderr) |
| 409 | _print("fatal: '%s' is not available" % GIT, file=sys.stderr) | 400 | print("fatal: '%s' is not available" % GIT, file=sys.stderr) |
| 410 | _print('fatal: %s' % e, file=sys.stderr) | 401 | print('fatal: %s' % e, file=sys.stderr) |
| 411 | _print(file=sys.stderr) | 402 | print(file=sys.stderr) |
| 412 | _print('Please make sure %s is installed and in your path.' % GIT, | 403 | print('Please make sure %s is installed and in your path.' % GIT, |
| 413 | file=sys.stderr) | 404 | file=sys.stderr) |
| 414 | raise CloneFailure() | 405 | raise CloneFailure() |
| 415 | 406 | ||
| 416 | ver_str = proc.stdout.read().strip() | 407 | ver_str = proc.stdout.read().strip() |
| @@ -419,12 +410,12 @@ def _CheckGitVersion(): | |||
| 419 | 410 | ||
| 420 | ver_act = ParseGitVersion(ver_str) | 411 | ver_act = ParseGitVersion(ver_str) |
| 421 | if ver_act is None: | 412 | if ver_act is None: |
| 422 | _print('error: "%s" unsupported' % ver_str, file=sys.stderr) | 413 | print('error: "%s" unsupported' % ver_str, file=sys.stderr) |
| 423 | raise CloneFailure() | 414 | raise CloneFailure() |
| 424 | 415 | ||
| 425 | if ver_act < MIN_GIT_VERSION: | 416 | if ver_act < MIN_GIT_VERSION: |
| 426 | need = '.'.join(map(str, MIN_GIT_VERSION)) | 417 | need = '.'.join(map(str, MIN_GIT_VERSION)) |
| 427 | _print('fatal: git %s or later required' % need, file=sys.stderr) | 418 | print('fatal: git %s or later required' % need, file=sys.stderr) |
| 428 | raise CloneFailure() | 419 | raise CloneFailure() |
| 429 | 420 | ||
| 430 | 421 | ||
| @@ -451,16 +442,16 @@ def SetupGnuPG(quiet): | |||
| 451 | os.mkdir(home_dot_repo) | 442 | os.mkdir(home_dot_repo) |
| 452 | except OSError as e: | 443 | except OSError as e: |
| 453 | if e.errno != errno.EEXIST: | 444 | if e.errno != errno.EEXIST: |
| 454 | _print('fatal: cannot make %s directory: %s' | 445 | print('fatal: cannot make %s directory: %s' |
| 455 | % (home_dot_repo, e.strerror), file=sys.stderr) | 446 | % (home_dot_repo, e.strerror), file=sys.stderr) |
| 456 | sys.exit(1) | 447 | sys.exit(1) |
| 457 | 448 | ||
| 458 | try: | 449 | try: |
| 459 | os.mkdir(gpg_dir, stat.S_IRWXU) | 450 | os.mkdir(gpg_dir, stat.S_IRWXU) |
| 460 | except OSError as e: | 451 | except OSError as e: |
| 461 | if e.errno != errno.EEXIST: | 452 | if e.errno != errno.EEXIST: |
| 462 | _print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror), | 453 | print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror), |
| 463 | file=sys.stderr) | 454 | file=sys.stderr) |
| 464 | sys.exit(1) | 455 | sys.exit(1) |
| 465 | 456 | ||
| 466 | env = os.environ.copy() | 457 | env = os.environ.copy() |
| @@ -476,18 +467,18 @@ def SetupGnuPG(quiet): | |||
| 476 | stdin=subprocess.PIPE) | 467 | stdin=subprocess.PIPE) |
| 477 | except OSError as e: | 468 | except OSError as e: |
| 478 | if not quiet: | 469 | if not quiet: |
| 479 | _print('warning: gpg (GnuPG) is not available.', file=sys.stderr) | 470 | print('warning: gpg (GnuPG) is not available.', file=sys.stderr) |
| 480 | _print('warning: Installing it is strongly encouraged.', file=sys.stderr) | 471 | print('warning: Installing it is strongly encouraged.', file=sys.stderr) |
| 481 | _print(file=sys.stderr) | 472 | print(file=sys.stderr) |
| 482 | return False | 473 | return False |
| 483 | 474 | ||
| 484 | proc.stdin.write(MAINTAINER_KEYS) | 475 | proc.stdin.write(MAINTAINER_KEYS) |
| 485 | proc.stdin.close() | 476 | proc.stdin.close() |
| 486 | 477 | ||
| 487 | if proc.wait() != 0: | 478 | if proc.wait() != 0: |
| 488 | _print('fatal: registering repo maintainer keys failed', file=sys.stderr) | 479 | print('fatal: registering repo maintainer keys failed', file=sys.stderr) |
| 489 | sys.exit(1) | 480 | sys.exit(1) |
| 490 | _print() | 481 | print() |
| 491 | 482 | ||
| 492 | fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w') | 483 | fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w') |
| 493 | fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n') | 484 | fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n') |
| @@ -530,7 +521,7 @@ def _InitHttp(): | |||
| 530 | 521 | ||
| 531 | def _Fetch(url, local, src, quiet): | 522 | def _Fetch(url, local, src, quiet): |
| 532 | if not quiet: | 523 | if not quiet: |
| 533 | _print('Get %s' % url, file=sys.stderr) | 524 | print('Get %s' % url, file=sys.stderr) |
| 534 | 525 | ||
| 535 | cmd = [GIT, 'fetch'] | 526 | cmd = [GIT, 'fetch'] |
| 536 | if quiet: | 527 | if quiet: |
| @@ -580,16 +571,16 @@ def _DownloadBundle(url, local, quiet): | |||
| 580 | except urllib.error.HTTPError as e: | 571 | except urllib.error.HTTPError as e: |
| 581 | if e.code in [401, 403, 404, 501]: | 572 | if e.code in [401, 403, 404, 501]: |
| 582 | return False | 573 | return False |
| 583 | _print('fatal: Cannot get %s' % url, file=sys.stderr) | 574 | print('fatal: Cannot get %s' % url, file=sys.stderr) |
| 584 | _print('fatal: HTTP error %s' % e.code, file=sys.stderr) | 575 | print('fatal: HTTP error %s' % e.code, file=sys.stderr) |
| 585 | raise CloneFailure() | 576 | raise CloneFailure() |
| 586 | except urllib.error.URLError as e: | 577 | except urllib.error.URLError as e: |
| 587 | _print('fatal: Cannot get %s' % url, file=sys.stderr) | 578 | print('fatal: Cannot get %s' % url, file=sys.stderr) |
| 588 | _print('fatal: error %s' % e.reason, file=sys.stderr) | 579 | print('fatal: error %s' % e.reason, file=sys.stderr) |
| 589 | raise CloneFailure() | 580 | raise CloneFailure() |
| 590 | try: | 581 | try: |
| 591 | if not quiet: | 582 | if not quiet: |
| 592 | _print('Get %s' % url, file=sys.stderr) | 583 | print('Get %s' % url, file=sys.stderr) |
| 593 | while True: | 584 | while True: |
| 594 | buf = r.read(8192) | 585 | buf = r.read(8192) |
| 595 | if buf == '': | 586 | if buf == '': |
| @@ -615,23 +606,23 @@ def _Clone(url, local, quiet, clone_bundle): | |||
| 615 | try: | 606 | try: |
| 616 | os.mkdir(local) | 607 | os.mkdir(local) |
| 617 | except OSError as e: | 608 | except OSError as e: |
| 618 | _print('fatal: cannot make %s directory: %s' % (local, e.strerror), | 609 | print('fatal: cannot make %s directory: %s' % (local, e.strerror), |
| 619 | file=sys.stderr) | 610 | file=sys.stderr) |
| 620 | raise CloneFailure() | 611 | raise CloneFailure() |
| 621 | 612 | ||
| 622 | cmd = [GIT, 'init', '--quiet'] | 613 | cmd = [GIT, 'init', '--quiet'] |
| 623 | try: | 614 | try: |
| 624 | proc = subprocess.Popen(cmd, cwd=local) | 615 | proc = subprocess.Popen(cmd, cwd=local) |
| 625 | except OSError as e: | 616 | except OSError as e: |
| 626 | _print(file=sys.stderr) | 617 | print(file=sys.stderr) |
| 627 | _print("fatal: '%s' is not available" % GIT, file=sys.stderr) | 618 | print("fatal: '%s' is not available" % GIT, file=sys.stderr) |
| 628 | _print('fatal: %s' % e, file=sys.stderr) | 619 | print('fatal: %s' % e, file=sys.stderr) |
| 629 | _print(file=sys.stderr) | 620 | print(file=sys.stderr) |
| 630 | _print('Please make sure %s is installed and in your path.' % GIT, | 621 | print('Please make sure %s is installed and in your path.' % GIT, |
| 631 | file=sys.stderr) | 622 | file=sys.stderr) |
| 632 | raise CloneFailure() | 623 | raise CloneFailure() |
| 633 | if proc.wait() != 0: | 624 | if proc.wait() != 0: |
| 634 | _print('fatal: could not create %s' % local, file=sys.stderr) | 625 | print('fatal: could not create %s' % local, file=sys.stderr) |
| 635 | raise CloneFailure() | 626 | raise CloneFailure() |
| 636 | 627 | ||
| 637 | _InitHttp() | 628 | _InitHttp() |
| @@ -659,18 +650,18 @@ def _Verify(cwd, branch, quiet): | |||
| 659 | proc.stderr.close() | 650 | proc.stderr.close() |
| 660 | 651 | ||
| 661 | if proc.wait() != 0 or not cur: | 652 | if proc.wait() != 0 or not cur: |
| 662 | _print(file=sys.stderr) | 653 | print(file=sys.stderr) |
| 663 | _print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr) | 654 | print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr) |
| 664 | raise CloneFailure() | 655 | raise CloneFailure() |
| 665 | 656 | ||
| 666 | m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur) | 657 | m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur) |
| 667 | if m: | 658 | if m: |
| 668 | cur = m.group(1) | 659 | cur = m.group(1) |
| 669 | if not quiet: | 660 | if not quiet: |
| 670 | _print(file=sys.stderr) | 661 | print(file=sys.stderr) |
| 671 | _print("info: Ignoring branch '%s'; using tagged release '%s'" | 662 | print("info: Ignoring branch '%s'; using tagged release '%s'" |
| 672 | % (branch, cur), file=sys.stderr) | 663 | % (branch, cur), file=sys.stderr) |
| 673 | _print(file=sys.stderr) | 664 | print(file=sys.stderr) |
| 674 | 665 | ||
| 675 | env = os.environ.copy() | 666 | env = os.environ.copy() |
| 676 | try: | 667 | try: |
| @@ -691,10 +682,10 @@ def _Verify(cwd, branch, quiet): | |||
| 691 | proc.stderr.close() | 682 | proc.stderr.close() |
| 692 | 683 | ||
| 693 | if proc.wait() != 0: | 684 | if proc.wait() != 0: |
| 694 | _print(file=sys.stderr) | 685 | print(file=sys.stderr) |
| 695 | _print(out, file=sys.stderr) | 686 | print(out, file=sys.stderr) |
| 696 | _print(err, file=sys.stderr) | 687 | print(err, file=sys.stderr) |
| 697 | _print(file=sys.stderr) | 688 | print(file=sys.stderr) |
| 698 | raise CloneFailure() | 689 | raise CloneFailure() |
| 699 | return '%s^0' % cur | 690 | return '%s^0' % cur |
| 700 | 691 | ||
| @@ -765,7 +756,7 @@ def _Usage(): | |||
| 765 | if get_gitc_manifest_dir(): | 756 | if get_gitc_manifest_dir(): |
| 766 | gitc_usage = " gitc-init Initialize a GITC Client.\n" | 757 | gitc_usage = " gitc-init Initialize a GITC Client.\n" |
| 767 | 758 | ||
| 768 | _print( | 759 | print( |
| 769 | """usage: repo COMMAND [ARGS] | 760 | """usage: repo COMMAND [ARGS] |
| 770 | 761 | ||
| 771 | repo is not yet installed. Use "repo init" to install it here. | 762 | repo is not yet installed. Use "repo init" to install it here. |
| @@ -791,23 +782,23 @@ def _Help(args): | |||
| 791 | init_optparse.print_help() | 782 | init_optparse.print_help() |
| 792 | sys.exit(0) | 783 | sys.exit(0) |
| 793 | else: | 784 | else: |
| 794 | _print("error: '%s' is not a bootstrap command.\n" | 785 | print("error: '%s' is not a bootstrap command.\n" |
| 795 | ' For access to online help, install repo ("repo init").' | 786 | ' For access to online help, install repo ("repo init").' |
| 796 | % args[0], file=sys.stderr) | 787 | % args[0], file=sys.stderr) |
| 797 | else: | 788 | else: |
| 798 | _Usage() | 789 | _Usage() |
| 799 | sys.exit(1) | 790 | sys.exit(1) |
| 800 | 791 | ||
| 801 | 792 | ||
| 802 | def _NotInstalled(): | 793 | def _NotInstalled(): |
| 803 | _print('error: repo is not installed. Use "repo init" to install it here.', | 794 | print('error: repo is not installed. Use "repo init" to install it here.', |
| 804 | file=sys.stderr) | 795 | file=sys.stderr) |
| 805 | sys.exit(1) | 796 | sys.exit(1) |
| 806 | 797 | ||
| 807 | 798 | ||
| 808 | def _NoCommands(cmd): | 799 | def _NoCommands(cmd): |
| 809 | _print("""error: command '%s' requires repo to be installed first. | 800 | print("""error: command '%s' requires repo to be installed first. |
| 810 | Use "repo init" to install it here.""" % cmd, file=sys.stderr) | 801 | Use "repo init" to install it here.""" % cmd, file=sys.stderr) |
| 811 | sys.exit(1) | 802 | sys.exit(1) |
| 812 | 803 | ||
| 813 | 804 | ||
| @@ -844,7 +835,7 @@ def _SetDefaultsTo(gitdir): | |||
| 844 | proc.stderr.close() | 835 | proc.stderr.close() |
| 845 | 836 | ||
| 846 | if proc.wait() != 0: | 837 | if proc.wait() != 0: |
| 847 | _print('fatal: %s has no current branch' % gitdir, file=sys.stderr) | 838 | print('fatal: %s has no current branch' % gitdir, file=sys.stderr) |
| 848 | sys.exit(1) | 839 | sys.exit(1) |
| 849 | 840 | ||
| 850 | 841 | ||
| @@ -861,10 +852,10 @@ def main(orig_args): | |||
| 861 | 852 | ||
| 862 | cwd = os.getcwd() | 853 | cwd = os.getcwd() |
| 863 | if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()): | 854 | if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()): |
| 864 | _print('error: repo cannot be used in the GITC local manifest directory.' | 855 | print('error: repo cannot be used in the GITC local manifest directory.' |
| 865 | '\nIf you want to work on this GITC client please rerun this ' | 856 | '\nIf you want to work on this GITC client please rerun this ' |
| 866 | 'command from the corresponding client under /gitc/', | 857 | 'command from the corresponding client under /gitc/', |
| 867 | file=sys.stderr) | 858 | file=sys.stderr) |
| 868 | sys.exit(1) | 859 | sys.exit(1) |
| 869 | if not repo_main: | 860 | if not repo_main: |
| 870 | if opt.help: | 861 | if opt.help: |
| @@ -880,8 +871,8 @@ def main(orig_args): | |||
| 880 | _Init(args, gitc_init=(cmd == 'gitc-init')) | 871 | _Init(args, gitc_init=(cmd == 'gitc-init')) |
| 881 | except CloneFailure: | 872 | except CloneFailure: |
| 882 | path = os.path.join(repodir, S_repo) | 873 | path = os.path.join(repodir, S_repo) |
| 883 | _print("fatal: cloning the git-repo repository failed, will remove " | 874 | print("fatal: cloning the git-repo repository failed, will remove " |
| 884 | "'%s' " % path, file=sys.stderr) | 875 | "'%s' " % path, file=sys.stderr) |
| 885 | shutil.rmtree(path, ignore_errors=True) | 876 | shutil.rmtree(path, ignore_errors=True) |
| 886 | sys.exit(1) | 877 | sys.exit(1) |
| 887 | repo_main, rel_repo_dir = _FindRepo() | 878 | repo_main, rel_repo_dir = _FindRepo() |
| @@ -905,14 +896,14 @@ def main(orig_args): | |||
| 905 | else: | 896 | else: |
| 906 | os.execv(sys.executable, me) | 897 | os.execv(sys.executable, me) |
| 907 | except OSError as e: | 898 | except OSError as e: |
| 908 | _print("fatal: unable to start %s" % repo_main, file=sys.stderr) | 899 | print("fatal: unable to start %s" % repo_main, file=sys.stderr) |
| 909 | _print("fatal: %s" % e, file=sys.stderr) | 900 | print("fatal: %s" % e, file=sys.stderr) |
| 910 | sys.exit(148) | 901 | sys.exit(148) |
| 911 | 902 | ||
| 912 | 903 | ||
| 913 | if __name__ == '__main__': | 904 | if __name__ == '__main__': |
| 914 | if ver[0] == 3: | 905 | if ver[0] == 3: |
| 915 | _print('warning: Python 3 support is currently experimental. YMMV.\n' | 906 | print('warning: Python 3 support is currently experimental. YMMV.\n' |
| 916 | 'Please use Python 2.7 instead.', | 907 | 'Please use Python 2.7 instead.', |
| 917 | file=sys.stderr) | 908 | file=sys.stderr) |
| 918 | main(sys.argv[1:]) | 909 | main(sys.argv[1:]) |
