Failure in t6021 on Red Hat Enterprise Linux 4
Running t/t6021-crisscross-merge.sh -v -i on Red Hat Enterprise Linux 4 Workstation with python 2.3.4 installed, I found a fatal error in the test.
Apparently, this release of python doesn't have the subprocess module installed. In what package is that located? How can I fix this error?
Thanks!
--Mark
-- BEGIN --
[mallen@mrhat t]$ rpm -q python
python-2.3.4-14.1
...SNIP...
git commit -m D8 file
Committing initial tree ec103796f9a6ca8367bd90cd88edf39c5dd2ae26 Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Traceback (most recent call last):
File "/home/mallen/git/git.git/t/../git-merge-recursive", line 13, in ?
from gitMergeCommon import *
File "/home/mallen/git/git.git/gitMergeCommon.py", line 18, in ?
import subprocess
ImportError: No module named subprocess
Automatic merge failed/prevented; fix up by hand
...SNIP...
--- END ---
Quoted 2 lines · Mark Allen
Running
t/t6021-crisscross-merge.sh-v -i on Red Hat Enterprise Linux 4 Workstation with python 2.3.4 installed, I found a fatal error in the test.
Are you using git RPM, or building by hand?
If the latter, "grep -A2 python INSTALL" may be helpful.
Quoted 2 lines · --- Junio C Hamano
Are you using git RPM, or building by hand?
If the latter, "grep -A2 python INSTALL" may be helpful.
Definitely. Thanks for the pointer -- I rebuilt my git installation with the correct flag, but there's a bootstrapping problem with the test -- and I'm not a good enough python programmer to fix it very well.
So, basically the problem is that the subprocess.py module is in the compat directory, and by default (I think) the git-merge-recursive being tested is only looking in $HOME/git/git.git where it finds and loads gitMergeCommon.py, but gitMergeCommon.py is not looking in $HOME/git/git.git/compat which is where subprocess.py lives.
So I hacked in to git-merge-recursive this line at the top of the file
sys.path.append('''/home/mallen/git/git.git/compat''')
at the very top and now the test passes.
So maybe this points out a problem in the Makefile or in the substitution the Makefile is using to put in @@GIT_PYTHON_PATH@@
I'm not sure I've clearly explained the issue, and like I said, I'm kind of a Python baby, so I'm not sure what the best way to fix this problem might be.
Thanks,
--Mark
Quoted 2 lines · Mark Allen
So, basically the problem is that the
subprocess.pymodule is in the compat directory, and by default (I think)..
Ah, you are right.
Just like we fix PATH and GIT_EXEC_PATH during the test execution, we need to do something with PYTHONPATH environment variable (this one is _without_ underscore), I think.
PATCH 1/1 Make sure we use compat/subprocess.py with Python 2.3 while running tests.
Otherwise the test will not succeed without installing.
---
Quoted 10 lines · Junio C Hamano
Quoted 2 lines · Mark Allen
So, basically the problem is that the
subprocess.pymodule is in the compat directory, and by default (I think)..Ah, you are right.
Just like we fix PATH and
GIT_EXEC_PATHduring the test execution, we need to do something with PYTHONPATH environment variable (this one is _without_ underscore), I think.
This seems to fix it for me.
t/test-lib.sh | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
49ccb0877f64308662669a09db7b221419c13d0a
t/test-lib.sh +12 -1
@@ -172,7 +172,18 @@ test_done () { # t/ subdirectory and are run in trash subdirectory. PATH=$(pwd)/..:$PATH GIT_EXEC_PATH=$(pwd)/.. -export GIT_EXEC_PATH +export PATH GIT_EXEC_PATH + +# Similarly use ../compat/subprocess.py if our python does not +# have subprocess.py on its own. +PYTHON=`sed -e '1{ + s/^#!// + q +}' ../git-merge-recursive` && +"$PYTHON" -c 'import subprocess' 2>/dev/null || { + PYTHONPATH=$(pwd)/../compat + export PYTHONPATH +} # Test repository test=trash
Signature · 1 line
0.99.9.GIT
Re: [PATCH] Make sure we use compat/subprocess.py with Python 2.3 while running tests.
Quoted 1 line · --- Junio C Hamano
This seems to fix it for me.
Works on my build here. Thanks!
--Mark