* [PATCH 5/5] Optionally work without python
@ 2006-02-17 14:24 Johannes Schindelin
2006-02-17 21:07 ` Radoslaw Szkodzinski
2006-02-18 6:50 ` Junio C Hamano
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schindelin @ 2006-02-17 14:24 UTC (permalink / raw)
To: git, junkio
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>
---
Makefile | 8 +++++++-
git-merge.sh | 6 +++++-
t/Makefile | 5 +++++
t/t0000-basic.sh | 2 ++
t/t6021-merge-criss-cross.sh | 6 ++++++
t/t6022-merge-rename.sh | 6 ++++++
t/test-lib.sh | 2 ++
7 files changed, 33 insertions(+), 2 deletions(-)
aa0aef85a93da00f3afbbed9105b45ad41b8427c
diff --git a/Makefile b/Makefile
index 7e1990b..1ee61e6 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
@@ -422,6 +424,9 @@ endif
ifdef NO_ACCURATE_DIFF
ALL_CFLAGS += -DNO_ACCURATE_DIFF
endif
+ifdef NO_PYTHON
+ TEST_DEFS += NO_PYTHON=YesPlease
+endif
# Shell quote (do not use $(call) to accomodate ancient setups);
@@ -462,6 +467,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_QUOTED)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+ -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
$@.sh >$@
chmod +x $@
@@ -552,7 +558,7 @@ doc:
### Testing rules
test: all
- $(MAKE) -C t/ all
+ $(MAKE) -C t/ all $(TEST_DEFS)
test-date$X: test-date.c date.o ctype.o
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o
diff --git a/git-merge.sh b/git-merge.sh
index 74f0761..c0f53df 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -11,7 +11,11 @@ LF='
'
all_strategies='recursive octopus resolve stupid ours'
-default_strategies='recursive'
+if test -z "@@NO_PYTHON@@"; then
+ default_strategies='recursive'
+else
+ default_strategies='resolve'
+fi
use_strategies=
dropsave() {
diff --git a/t/Makefile b/t/Makefile
index d78404f..12e2c16 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -12,9 +12,14 @@ SHELL_PATH_QUOTED = '$(subst ','\'',$(SH
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):
+ echo $(SHELL_PATH_QUOTED) $@ $(GIT_TEST_OPTS)
@echo "*** $@ ***"; $(SHELL_PATH_QUOTED) $@ $(GIT_TEST_OPTS)
clean:
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index c339a36..fe7f448 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -42,11 +42,13 @@ fi
. ./test-lib.sh
+if test -z "$no_python"; then
"$PYTHON" -c 'import subprocess' || {
echo >&2 'Your python seem to lack "subprocess" module.
Please check INSTALL document.'
exit 1
}
+fi
################################################################
# init-db has been done in an empty repository.
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index e8606c7..2623813 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -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
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index 1292caf..a2d24b5 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a58a86..43c8e55 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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
--
1.2.1.g09fe-dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] Optionally work without python
2006-02-17 14:24 [PATCH 5/5] Optionally work without python Johannes Schindelin
@ 2006-02-17 21:07 ` Radoslaw Szkodzinski
2006-02-18 6:50 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Radoslaw Szkodzinski @ 2006-02-17 21:07 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, junkio
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
Johannes Schindelin wrote:
> In some setups (notably server setups) you do not need that dependency.
> Gracefully handle the absence of python when NO_PYTHON is defined.
>
> +# Define NO_PYTHON if you want to loose all benefits of the recursive merge.
lose
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -11,7 +11,11 @@ LF='
> '
>
> all_strategies='recursive octopus resolve stupid ours'
Maybe use this:
default_strategies='recursive'
if test -n "@@NO_PYTHON@@"; then
default_strategies='resolve'
fi
--
GPG Key id: 0xD1F10BA2
Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2
AstralStorm
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] Optionally work without python
2006-02-17 14:24 [PATCH 5/5] Optionally work without python Johannes Schindelin
2006-02-17 21:07 ` Radoslaw Szkodzinski
@ 2006-02-18 6:50 ` Junio C Hamano
2006-02-18 12:01 ` Johannes Schindelin
1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-02-18 6:50 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> In some setups (notably server setups) you do not need that dependency.
> Gracefully handle the absence of python when NO_PYTHON is defined.
> +ifdef NO_PYTHON
> + TEST_DEFS += NO_PYTHON=YesPlease
> +endif
I wonder if there is a better way to do this. All future
NO_BLAH that may affect tests need to have something like this
otherwise.
> -default_strategies='recursive'
> +if test -z "@@NO_PYTHON@@"; then
> + default_strategies='recursive'
> +else
> + default_strategies='resolve'
> +fi
Somebody commented on this part to make it shorter...
I'll take 2, 3, and 4 from this series for now. They will
appear in "next". Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 5/5] Optionally work without python
2006-02-18 6:50 ` Junio C Hamano
@ 2006-02-18 12:01 ` Johannes Schindelin
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2006-02-18 12:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
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>
---
On Fri, 17 Feb 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > +ifdef NO_PYTHON
> > + TEST_DEFS += NO_PYTHON=YesPlease
> > +endif
>
> I wonder if there is a better way to do this. All future
> NO_BLAH that may affect tests need to have something like this
> otherwise.
There is: Just an "export". This defines all variables in a
sub-make. However, if you do that, the environment gets quite
large, and some programs crash, notably xargs on the box I tested.
So, for now, use "export NO_PYTHON".
> > -default_strategies='recursive'
> > +if test -z "@@NO_PYTHON@@"; then
> > + default_strategies='recursive'
> > +else
> > + default_strategies='resolve'
> > +fi
>
> Somebody commented on this part to make it shorter...
Fixed.
> I'll take 2, 3, and 4 from this series for now. They will
> appear in "next". Thanks.
Thank you!
Makefile | 9 +++++++++
git-merge.sh | 4 ++++
t/Makefile | 6 ++++
t/t0000-basic.sh | 2 +-
t/t6021-merge-criss-cross.sh | 6 ++++++
t/t6022-merge-rename.sh | 6 ++++++
t/test-lib.sh | 2 ++
7 files changed, 32 insertions(+), 1 deletions(-)
b7c435d3d594c9826e4297ee8b0353d27ef8c5b0
diff --git a/Makefile b/Makefile
index d59eede..685b714 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
@@ -460,6 +462,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_QUOTED)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+ -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
$@.sh >$@
chmod +x $@
@@ -548,6 +551,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
diff --git a/git-merge.sh b/git-merge.sh
index 74f0761..a05eeb2 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -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" \
diff --git a/t/Makefile b/t/Makefile
index e7e4229..4e89d23 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -12,10 +12,14 @@ SHELL_PATH_QUOTED = $(subst ','\'',$(SHE
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):
@echo "*** $@ ***"; '$(SHELL_PATH_QUOTED)' $@ $(GIT_TEST_OPTS)
clean:
rm -fr trash
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index c339a36..6729a18 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -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
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index e8606c7..2623813 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -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
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index 1292caf..a2d24b5 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a58a86..43c8e55 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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
--
1.2.1.g05ee-dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-02-18 12:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-17 14:24 [PATCH 5/5] Optionally work without python Johannes Schindelin
2006-02-17 21:07 ` Radoslaw Szkodzinski
2006-02-18 6:50 ` Junio C Hamano
2006-02-18 12:01 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).