@matheusbsbs / matheus-bagliano / commits / abb7c7b31c
Fork 0

Optionally work without python

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>

Johannes Schindelin committed Feb 18, 2006 at 13:01 UTC abb7c7b31c0896bd838bbb6437b310db5a42227a
7 files changed +32 -1
Makefile
+9
@@ -58,6 +58,8 @@ all:
58 # Define NO_ACCURATE_DIFF if your diff program at least sometimes misses
59 # a missing newline at the end of the file.
60 #
61 +# Define NO_PYTHON if you want to loose all benefits of the recursive merge.
62 +#
63 # Define COLLISION_CHECK below if you believe that SHA1's
64 # 1461501637330902918203684832716283019655932542976 hashes do not give you
65 # sufficient guarantee that no collisions between objects will ever happen.
@@ -442,6 +444,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
444 sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
445 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
446 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
447 + -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
448 $@.sh >$@
449 chmod +x $@
450
@@ -521,6 +524,12 @@ doc:
524
525 ### Testing rules
526
527 +# GNU make supports exporting all variables by "export" without parameters.
528 +# However, the environment gets quite big, and some programs have problems
529 +# with that.
530 +
531 +export NO_PYTHON
532 +
533 test: all
534 $(MAKE) -C t/ all
535
git-merge.sh
+4
@@ -13,6 +13,10 @@ LF='
13 all_strategies='recursive octopus resolve stupid ours'
14 default_strategies='recursive'
15 use_strategies=
16 +if test "@@NO_PYTHON@@"; then
17 + all_strategies='resolve octopus stupid ours'
18 + default_strategies='resolve'
19 +fi
20
21 dropsave() {
22 rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
t/Makefile
+4
@@ -15,6 +15,10 @@ shellquote = '$(call shq,$(1))'
15
16 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
17
18 +ifdef NO_PYTHON
19 + GIT_TEST_OPTS += --no-python
20 +endif
21 +
22 all: $(T) clean
23
24 $(T):
t/t0000-basic.sh
+1 -1
@@ -42,7 +42,7 @@ fi
42
43 . ./test-lib.sh
44
45 -"$PYTHON" -c 'import subprocess' || {
45 +test "$no_python" || "$PYTHON" -c 'import subprocess' || {
46 echo >&2 'Your python seem to lack "subprocess" module.
47 Please check INSTALL document.'
48 exit 1
t/t6021-merge-criss-cross.sh
+6
@@ -10,6 +10,12 @@
10 test_description='Test criss-cross merge'
11 . ./test-lib.sh
12
13 +if test "$no_python"; then
14 + echo "Skipping: no python => no recursive merge"
15 + test_done
16 + exit 0
17 +fi
18 +
19 test_expect_success 'prepare repository' \
20 'echo "1
21 2
t/t6022-merge-rename.sh
+6
@@ -3,6 +3,12 @@
3 test_description='Merge-recursive merging renames'
4 . ./test-lib.sh
5
6 +if test "$no_python"; then
7 + echo "Skipping: no python => no recursive merge"
8 + test_done
9 + exit 0
10 +fi
11 +
12 test_expect_success setup \
13 '
14 cat >A <<\EOF &&
t/test-lib.sh
+2
@@ -63,6 +63,8 @@ do
63 exit 0 ;;
64 -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
65 verbose=t; shift ;;
66 + --no-python)
67 + no_python=t; shift ;;
68 *)
69 break ;;
70 esac