(must_succeed=True)
| 737 | # If true, the search is required to succeed, and the execution |
| 738 | # will terminate with sys.exit(1) if not found. |
| 739 | def GIT(must_succeed=True): |
| 740 | global cached_git_executable |
| 741 | if cached_git_executable is not None: |
| 742 | return cached_git_executable |
| 743 | # The order in the following is important, and specifies the preferred order |
| 744 | # of using the git tools. Primarily use git from emsdk if installed. If not, |
| 745 | # use system git. |
| 746 | gits = ['git/1.9.4/bin/git.exe', shutil.which('git')] |
| 747 | for git in gits: |
| 748 | try: |
| 749 | ret, _stdout, _stderr = run_get_output([git, '--version']) |
| 750 | if ret == 0: |
| 751 | cached_git_executable = git |
| 752 | return git |
| 753 | except Exception: |
| 754 | pass |
| 755 | if must_succeed: |
| 756 | if WINDOWS: |
| 757 | msg = "git executable was not found. Please install it by typing 'emsdk install git-1.9.4', or alternatively by installing it manually from http://git-scm.com/downloads . If you install git manually, remember to add it to PATH" |
| 758 | elif MACOS: |
| 759 | msg = "git executable was not found. Please install git for this operation! This can be done from http://git-scm.com/ , or by installing XCode and then the XCode Command Line Tools (see http://stackoverflow.com/questions/9329243/xcode-4-4-command-line-tools )" |
| 760 | elif LINUX: |
| 761 | msg = "git executable was not found. Please install git for this operation! This can be probably be done using your package manager, see http://git-scm.com/book/en/Getting-Started-Installing-Git" |
| 762 | else: |
| 763 | msg = "git executable was not found. Please install git for this operation!" |
| 764 | exit_with_error(msg) |
| 765 | # Not found |
| 766 | return '' |
| 767 | |
| 768 | |
| 769 | def git_repo_version(repo_path): |
no test coverage detected