mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2026-05-07 18:17:36 +02:00
Add an option to test the pre-installed scripts
This is useful for distros like Debian that do tests on installed packages. See-also: https://ci.debian.net/
This commit is contained in:
committed by
Mark Nauwelaerts
parent
8c08b6de21
commit
a08ad9d2b4
@@ -27,28 +27,33 @@ SHARNESS_BUILD_DIRECTORY="$(mktemp -d)"
|
||||
export PATH="${PATH#*:}"
|
||||
rmdir "$SHARNESS_BUILD_DIRECTORY"
|
||||
|
||||
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
|
||||
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
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user