Skip to content
Snippets Groups Projects
Commit 1ed5bb3a authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Make embedded Python scripts compatible with Python 2.5 *SIGH*

Apparently our TeamCity build machines are still not up to Python 2.6.
parent ff4addd1
No related branches found
No related tags found
No related merge requests found
...@@ -181,6 +181,7 @@ class NamedTempDir: public boost::noncopyable ...@@ -181,6 +181,7 @@ class NamedTempDir: public boost::noncopyable
// realpath() to compare properly. // realpath() to compare properly.
NamedTempDir(): NamedTempDir():
mPath(python_out("mkdtemp()", mPath(python_out("mkdtemp()",
"from __future__ import with_statement\n"
"import os.path, sys, tempfile\n" "import os.path, sys, tempfile\n"
"with open(sys.argv[1], 'w') as f:\n" "with open(sys.argv[1], 'w') as f:\n"
" f.write(os.path.realpath(tempfile.mkdtemp()))\n")) " f.write(os.path.realpath(tempfile.mkdtemp()))\n"))
...@@ -518,6 +519,7 @@ namespace tut ...@@ -518,6 +519,7 @@ namespace tut
// create one. Naturally, ensure we clean it up when done. // create one. Naturally, ensure we clean it up when done.
NamedTempDir tempdir; NamedTempDir tempdir;
PythonProcessLauncher py("getcwd()", PythonProcessLauncher py("getcwd()",
"from __future__ import with_statement\n"
"import os, sys\n" "import os, sys\n"
"with open(sys.argv[1], 'w') as f:\n" "with open(sys.argv[1], 'w') as f:\n"
" f.write(os.getcwd())\n"); " f.write(os.getcwd())\n");
...@@ -531,6 +533,7 @@ namespace tut ...@@ -531,6 +533,7 @@ namespace tut
{ {
set_test_name("clearArguments()"); set_test_name("clearArguments()");
PythonProcessLauncher py("args", PythonProcessLauncher py("args",
"from __future__ import with_statement\n"
"import sys\n" "import sys\n"
// note nonstandard output-file arg! // note nonstandard output-file arg!
"with open(sys.argv[3], 'w') as f:\n" "with open(sys.argv[3], 'w') as f:\n"
...@@ -568,6 +571,7 @@ namespace tut ...@@ -568,6 +571,7 @@ namespace tut
{ {
set_test_name("explicit kill()"); set_test_name("explicit kill()");
PythonProcessLauncher py("kill()", PythonProcessLauncher py("kill()",
"from __future__ import with_statement\n"
"import sys, time\n" "import sys, time\n"
"with open(sys.argv[1], 'w') as f:\n" "with open(sys.argv[1], 'w') as f:\n"
" f.write('ok')\n" " f.write('ok')\n"
...@@ -610,6 +614,7 @@ namespace tut ...@@ -610,6 +614,7 @@ namespace tut
LLProcessLauncher::ll_pid_t pid(0); LLProcessLauncher::ll_pid_t pid(0);
{ {
PythonProcessLauncher py("kill()", PythonProcessLauncher py("kill()",
"from __future__ import with_statement\n"
"import sys, time\n" "import sys, time\n"
"with open(sys.argv[1], 'w') as f:\n" "with open(sys.argv[1], 'w') as f:\n"
" f.write('ok')\n" " f.write('ok')\n"
...@@ -655,6 +660,7 @@ namespace tut ...@@ -655,6 +660,7 @@ namespace tut
LLProcessLauncher::ll_pid_t pid(0); LLProcessLauncher::ll_pid_t pid(0);
{ {
PythonProcessLauncher py("orphan()", PythonProcessLauncher py("orphan()",
"from __future__ import with_statement\n"
"import sys, time\n" "import sys, time\n"
"with open(sys.argv[1], 'w') as f:\n" "with open(sys.argv[1], 'w') as f:\n"
" f.write('ok')\n" " f.write('ok')\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment