{"thread":{"id":"32401","subject":"[PATCH] t9020: use configured Python to run test helper","startedAt":"2012-12-19T04:49:09Z","lastAt":"2012-12-19T13:15:40Z","messageCount":2,"participants":["Junio C Hamano","Pete Wyckoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"205173","messageId":"7vip7yd4u2.fsf@alter.siamese.dyndns.org","threadId":"32401","inReplyTo":null,"subject":"[PATCH] t9020: use configured Python to run test helper","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-19T04:49:09Z","receivedAt":"2012-12-19T04:49:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The test helper svnrdump_sim.py is used as \"svnrdump\" during the\nexecution of this test, but the arrangement had a few undesirable\nthings:\n\n - it relied on symbolic links;\n - unportable \"export VAR=VAL\" was used;\n - GIT_BUILD_DIR variable was not quoted correctly;\n - it assumed that the Python interpreter is in /usr/bin/ and\n   called \"python\" (i.e. not \"python2.7\" etc.)\n\nRework this by writing a small shell script that spawns the right\nPython interpreter, using the right quoting.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * The analysis above counts more bugs than the number of lines that\n   are deleted in this section of the code...\n\n t/t9020-remote-svn.sh | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh\nindex 4f2dfe0..d7be66a 100755\n--- a/t/t9020-remote-svn.sh\n+++ b/t/t9020-remote-svn.sh\n@@ -12,9 +12,13 @@ then\n \ttest_done\n fi\n \n-# We override svnrdump by placing a symlink to the svnrdump-emulator in .\n-export PATH=\"$HOME:$PATH\"\n-ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py \"$HOME/svnrdump\"\n+# Override svnrdump with our simulator\n+PATH=\"$HOME:$PATH\"\n+export PATH PYTHON_PATH GIT_BUILD_DIR\n+\n+write_script \"$HOME/svnrdump\" <<\\EOF\n+exec \"$PYTHON_PATH\" \"$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py\" \"$@\"\n+EOF\n \n init_git () {\n \trm -fr .git &&\n-- \n1.8.1.rc2.196.g90926c8\n"},{"id":"205185","messageId":"20121219131540.GA14207@padd.com","threadId":"32401","inReplyTo":"7vip7yd4u2.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t9020: use configured Python to run test helper","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2012-12-19T13:15:40Z","receivedAt":"2012-12-19T13:15:40Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"gitster@pobox.com wrote on Tue, 18 Dec 2012 20:49 -0800:\n> The test helper svnrdump_sim.py is used as \"svnrdump\" during the\n> execution of this test, but the arrangement had a few undesirable\n> things:\n> \n>  - it relied on symbolic links;\n>  - unportable \"export VAR=VAL\" was used;\n>  - GIT_BUILD_DIR variable was not quoted correctly;\n>  - it assumed that the Python interpreter is in /usr/bin/ and\n>    called \"python\" (i.e. not \"python2.7\" etc.)\n> \n> Rework this by writing a small shell script that spawns the right\n> Python interpreter, using the right quoting.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n> \n>  * The analysis above counts more bugs than the number of lines that\n>    are deleted in this section of the code...\n> \n>  t/t9020-remote-svn.sh | 10 +++++++---\n>  1 file changed, 7 insertions(+), 3 deletions(-)\n> \n> diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh\n> index 4f2dfe0..d7be66a 100755\n> --- a/t/t9020-remote-svn.sh\n> +++ b/t/t9020-remote-svn.sh\n> @@ -12,9 +12,13 @@ then\n>  \ttest_done\n>  fi\n>  \n> -# We override svnrdump by placing a symlink to the svnrdump-emulator in .\n> -export PATH=\"$HOME:$PATH\"\n> -ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py \"$HOME/svnrdump\"\n> +# Override svnrdump with our simulator\n> +PATH=\"$HOME:$PATH\"\n> +export PATH PYTHON_PATH GIT_BUILD_DIR\n> +\n> +write_script \"$HOME/svnrdump\" <<\\EOF\n> +exec \"$PYTHON_PATH\" \"$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py\" \"$@\"\n> +EOF\n\nYou don't really need to export PYTHON_PATH and GIT_BUILD_DIR if\nyou get them expanded in the svnrdump script wrapper.  Unquote\nthe EOF but add \\ for $@.\n\nEither way it's a nice improvement, especially with the\nbugs/lines metric being >1.\n\n\t\t-- Pete\n"}]}