From e26c839e8205e77aac16f722b4396622f39862c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Sun, 7 Sep 2014 05:43:14 -0400 Subject: [PATCH] Add package for new Portable Git version 1.9.4 to the manifest. Adjust git usage by emsdk to never install git automatically, and prefer using system-provided git if it exists. Improve instructions to guide the user to manually installing git if not found. Fixes #13. --- emsdk | 44 +++++++++++++++++++++----------------------- emsdk_manifest.json | 16 ++++++++++++---- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/emsdk b/emsdk index 7386b0f..e29b0f8 100755 --- a/emsdk +++ b/emsdk @@ -323,32 +323,30 @@ def which(program): return None -warnonce_git_not_found = False - -def GIT(): - global warnonce_git_not_found - git = 'git/1.8.3/bin/git.exe' - try: - (ret, stdout, stderr) = run_get_output([git, '--version']) - if ret == 0: - return git - except: - pass - git = which('git') - try: - (ret, stdout, stderr) = run_get_output([git, '--version']) - if ret == 0: - return git - except: - pass - if not warnonce_git_not_found: +# must_succeed: If false, the search is performed silently without printing out errors if not found. Empty string is returned if git is not found. +# If true, the search is required to succeed, and the execution will terminate with sys.exit(1) if not found. +def GIT(must_succeed=True): + # The order in the following is important, and specifies the preferred order of using the git tools. + # Primarily use git from emsdk if installed. If not, use system git. + gits = ['git/1.9.4/bin/git.exe', which('git')] + for git in gits: + try: + (ret, stdout, stderr) = run_get_output([git, '--version']) + if ret == 0: + return git + except: + pass + if must_succeed: if WINDOWS: - print "ERROR: git executable was not found. Either install git manually and add it to PATH, or install the git tool via 'emsdk install git-1.8.3'" - else: + print "ERROR: 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" + elif OSX: print "ERROR: 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 )" - warnonce_git_not_found = True + elif LINUX: + print "ERROR: 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" + else: + print "ERROR: git executable was not found. Please install git for this operation!" sys.exit(1) - return 'git' + return '' # Not found def git_repo_version(repo_path): (returncode, stdout, stderr) = run_get_output([GIT(), 'log', '-n', '1', '--pretty="%aD %H"'], cwd=repo_path) diff --git a/emsdk_manifest.json b/emsdk_manifest.json index 0421095..ec492bb 100644 --- a/emsdk_manifest.json +++ b/emsdk_manifest.json @@ -262,6 +262,14 @@ "version": "1.8.3", "windows_url": "git_1.8.3.zip", "activated_path": "%installation_dir%/bin;%installation_dir%/cmd", + "activated_cfg": "EMSDK_GIT='%installation_dir%'", + "is_old": true + }, + { + "id": "git", + "version": "1.9.4", + "windows_url": "git_1.9.4.zip", + "activated_path": "%installation_dir%/bin;%installation_dir%/cmd", "activated_cfg": "EMSDK_GIT='%installation_dir%'" }, { @@ -462,13 +470,13 @@ { "version": "incoming", "bitness": 32, - "uses": ["git-1.8.3", "clang-incoming-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-incoming"], + "uses": ["clang-incoming-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-incoming"], "os": "win" }, { "version": "incoming", "bitness": 64, - "uses": ["git-1.8.3", "clang-incoming-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-incoming"], + "uses": ["clang-incoming-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-incoming"], "os": "win" }, { @@ -492,13 +500,13 @@ { "version": "master", "bitness": 32, - "uses": ["git-1.8.3", "clang-master-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-master"], + "uses": ["clang-master-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-master"], "os": "win" }, { "version": "master", "bitness": 64, - "uses": ["git-1.8.3", "clang-master-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-master"], + "uses": ["clang-master-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-master"], "os": "win" }, {