Skip to content

Commit

Permalink
Optionally work without python
Browse files Browse the repository at this point in the history
In some setups (notably server setups) you do not need that dependency.
Gracefully handle the absence of python when NO_PYTHON is defined.

Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Feb 19, 2006
1 parent 289c4b3 commit abb7c7b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ all:
# Define NO_ACCURATE_DIFF if your diff program at least sometimes misses
# a missing newline at the end of the file.
#
# Define NO_PYTHON if you want to loose all benefits of the recursive merge.
#
# Define COLLISION_CHECK below if you believe that SHA1's
# 1461501637330902918203684832716283019655932542976 hashes do not give you
# sufficient guarantee that no collisions between objects will ever happen.
Expand Down Expand Up @@ -442,6 +444,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
$@.sh >$@
chmod +x $@

Expand Down Expand Up @@ -521,6 +524,12 @@ doc:

### Testing rules

# GNU make supports exporting all variables by "export" without parameters.
# However, the environment gets quite big, and some programs have problems
# with that.

export NO_PYTHON

test: all
$(MAKE) -C t/ all

Expand Down
4 changes: 4 additions & 0 deletions git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ LF='
all_strategies='recursive octopus resolve stupid ours'
default_strategies='recursive'
use_strategies=
if test "@@NO_PYTHON@@"; then
all_strategies='resolve octopus stupid ours'
default_strategies='resolve'
fi

dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
Expand Down
4 changes: 4 additions & 0 deletions t/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ shellquote = '$(call shq,$(1))'

T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)

ifdef NO_PYTHON
GIT_TEST_OPTS += --no-python
endif

all: $(T) clean

$(T):
Expand Down
2 changes: 1 addition & 1 deletion t/t0000-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fi

. ./test-lib.sh

"$PYTHON" -c 'import subprocess' || {
test "$no_python" || "$PYTHON" -c 'import subprocess' || {
echo >&2 'Your python seem to lack "subprocess" module.
Please check INSTALL document.'
exit 1
Expand Down
6 changes: 6 additions & 0 deletions t/t6021-merge-criss-cross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
test_description='Test criss-cross merge'
. ./test-lib.sh

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

test_expect_success 'prepare repository' \
'echo "1
2
Expand Down
6 changes: 6 additions & 0 deletions t/t6022-merge-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
test_description='Merge-recursive merging renames'
. ./test-lib.sh

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

test_expect_success setup \
'
cat >A <<\EOF &&
Expand Down
2 changes: 2 additions & 0 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ do
exit 0 ;;
-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
verbose=t; shift ;;
--no-python)
no_python=t; shift ;;
*)
break ;;
esac
Expand Down

0 comments on commit abb7c7b

Please sign in to comment.