[RFC] fake editor for testing edit_commit_message
Alexander Belchenko
bialix at ukr.net
Wed Jan 4 23:55:38 GMT 2006
John Arbash Meinel пишет:
> Alexander Belchenko wrote:
>>I've got WindowsError in subprocess.py when I'm trying to do commit. I
>>don't understand why. Fully qualfied path to script also does not help. :-(
>
> I think the problem is that it is trying to spawn a program named
> "python fed.py" not a program "python" feeding it the argument "fed.py".
> This is definitely a tricky thing to do on windows, since windows
> doesn't support having executable scripts (other than .bat files).
> I suppose you could do:
>
> echo '@echo off' > test.bat
> echo 'python fed.py' >> test.bat
> And then use
> set BZR_EDITOR='test.bat'
Hmm. It seems working solution. I'm trying to use batch wrapper but
without visible success. But this one is working:
echo @echo off > fed.bat
echo python fed.py %1 >> fed.bat
But what about Linux systems? For Linux it should be fed.sh script,
isn't? If I simply create in test directory fed.bat or fed.sh depending
on what current OS is it will enough? Probably for Linux it should be
setting executable permission bit. I'm no Linux expert so someone help
is needed.
> We also can't just split based on whitespace, especially on windows,
> where you have "C:\Program Files\..."
Hmm... Looks on this code (msgeditor.py:: _run_editor() function):
def _run_editor(filename):
"""Try to execute an editor to edit the commit message."""
for e in _get_editor():
edargs = e.split(' ') # <<<<<<< HERE SPLIT ON SPACE
x = call(edargs + [filename])
if x == 0:
return True
elif x == 127:
continue
else:
break
raise BzrError("Could not start any editor. "
"Please specify $EDITOR or use ~/.bzr.conf/editor")
Probably this split is incorrect?
>>1) Is this `fed` is appropriate for using as part of selftest for
>>testing bzrlib/msgeditor.py::edit_commit_message() function?
> The problem is now bzr selftest requires that you have a working
> compiler, and that we know what it is. (cl, icc, gcc, mingw, etc)
That's why I want to use SCons.
> If we can stay with python, it would be greatly prefered. We require
> python, and it would be nice to not require other dependencies (yet :).
I'm +1 and +1 on this. May be I hasten to write C-program. I will try
another one fed with batch file.
Thanks for the reply.
--
Alexander
More information about the bazaar
mailing list