mirror of
				https://github.com/mnauw/git-remote-hg.git
				synced 2025-10-31 16:45:48 +01:00 
			
		
		
		
	t: post-merge adjust of test-lib.sh
This commit is contained in:
		| @@ -29,35 +29,6 @@ SHARNESS_BUILD_DIRECTORY="$(mktemp -d)" | |||||||
| export PATH="${PATH#*:}" | export PATH="${PATH#*:}" | ||||||
| rmdir "$SHARNESS_BUILD_DIRECTORY" | rmdir "$SHARNESS_BUILD_DIRECTORY" | ||||||
|  |  | ||||||
| if [ -z "$TEST_INSTALLED_SCRIPTS" ] ; then |  | ||||||
| 	if [ -n "$PYTHON" ] && "$PYTHON" -c 'import mercurial' 2> /dev/null ; then |  | ||||||
| 		: Use chosen Python version |  | ||||||
| 	elif python3 -c 'import mercurial' 2> /dev/null ; then |  | ||||||
| 		PYTHON=python3 |  | ||||||
| 	elif python2 -c 'import mercurial' 2> /dev/null ; then |  | ||||||
| 		PYTHON=python2 |  | ||||||
| 	elif python -c 'import mercurial' 2> /dev/null ; then |  | ||||||
| 		PYTHON=python |  | ||||||
| 	fi |  | ||||||
| 	if [ -n "$PYTHON" ] ; then |  | ||||||
| 		test_set_prereq PYTHON |  | ||||||
|  |  | ||||||
| 		# Change shebang on a copy of scripts to chosen Python version |  | ||||||
| 		TEST_BIN="$SHARNESS_TRASH_DIRECTORY/bin" |  | ||||||
| 		mkdir -p "$TEST_BIN" |  | ||||||
| 		for s in git-remote-hg git-hg-helper ; do |  | ||||||
| 			printf "%s\n" "#!/usr/bin/env $PYTHON" > "$TEST_BIN/$s" |  | ||||||
| 			tail -n +2 "$SHARNESS_TEST_DIRECTORY/../$s" >> "$TEST_BIN/$s" |  | ||||||
| 			chmod u+x "$TEST_BIN/$s" |  | ||||||
| 		done |  | ||||||
| 		export PATH="$TEST_BIN${PATH:+:$PATH}" |  | ||||||
| 		unset TEST_BIN |  | ||||||
| 	fi |  | ||||||
| else |  | ||||||
| 	# The build/install process ensures Python is available |  | ||||||
| 	test_set_prereq PYTHON |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| GIT_AUTHOR_EMAIL=author@example.com | GIT_AUTHOR_EMAIL=author@example.com | ||||||
| GIT_AUTHOR_NAME='A U Thor' | GIT_AUTHOR_NAME='A U Thor' | ||||||
| GIT_COMMITTER_EMAIL=committer@example.com | GIT_COMMITTER_EMAIL=committer@example.com | ||||||
| @@ -134,3 +105,32 @@ test_have_prereq() { | |||||||
|  |  | ||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | if [ -z "$TEST_INSTALLED_SCRIPTS" ] ; then | ||||||
|  | 	if [ -n "$PYTHON" ] && "$PYTHON" -c 'import mercurial' 2> /dev/null ; then | ||||||
|  | 		: Use chosen Python version | ||||||
|  | 	elif python3 -c 'import mercurial' 2> /dev/null ; then | ||||||
|  | 		PYTHON=python3 | ||||||
|  | 	elif python2 -c 'import mercurial' 2> /dev/null ; then | ||||||
|  | 		PYTHON=python2 | ||||||
|  | 	elif python -c 'import mercurial' 2> /dev/null ; then | ||||||
|  | 		PYTHON=python | ||||||
|  | 	fi | ||||||
|  | 	if [ -n "$PYTHON" ] ; then | ||||||
|  | 		test_set_prereq PYTHON | ||||||
|  |  | ||||||
|  | 		# Change shebang on a copy of scripts to chosen Python version | ||||||
|  | 		TEST_BIN="$SHARNESS_TRASH_DIRECTORY/bin" | ||||||
|  | 		mkdir -p "$TEST_BIN" | ||||||
|  | 		for s in git-remote-hg git-hg-helper ; do | ||||||
|  | 			printf "%s\n" "#!/usr/bin/env $PYTHON" > "$TEST_BIN/$s" | ||||||
|  | 			tail -n +2 "$SHARNESS_TEST_DIRECTORY/../$s" >> "$TEST_BIN/$s" | ||||||
|  | 			chmod u+x "$TEST_BIN/$s" | ||||||
|  | 		done | ||||||
|  | 		export PATH="$TEST_BIN${PATH:+:$PATH}" | ||||||
|  | 		unset TEST_BIN | ||||||
|  | 	fi | ||||||
|  | else | ||||||
|  | 	# The build/install process ensures Python is available | ||||||
|  | 	test_set_prereq PYTHON | ||||||
|  | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user