summaryrefslogtreecommitdiff
path: root/numpy/distutils/exec_command.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2010-05-11 20:42:42 +0000
committerPauli Virtanen <pav@iki.fi>2010-05-11 20:42:42 +0000
commit4e2e78f908d8b8191b6257614096801c5d1af2f4 (patch)
tree111f005ea3032ab679ea49badd486632c98dc97d /numpy/distutils/exec_command.py
parente3cea87edc4a036b7e5643a488615c57c41de739 (diff)
downloadnumpy-4e2e78f908d8b8191b6257614096801c5d1af2f4.tar.gz
BUG/3K: distutils: do not assume that files output e.g. by gcc can be read in ascii codec
Diffstat (limited to 'numpy/distutils/exec_command.py')
-rw-r--r--numpy/distutils/exec_command.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py
index e1855df20..e0c3e1c97 100644
--- a/numpy/distutils/exec_command.py
+++ b/numpy/distutils/exec_command.py
@@ -55,6 +55,8 @@ from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
from numpy.distutils.compat import get_exception
+from numpy.compat import open_latin1
+
def temp_file_name():
fo, name = make_temp_file()
fo.close()
@@ -248,13 +250,13 @@ def _exec_command_posix( command,
return _exec_command(command, use_shell=use_shell, **env)
if stsfile is not None:
- f = open(stsfile,'r')
+ f = open_latin1(stsfile,'r')
status_text = f.read()
status = int(status_text)
f.close()
os.remove(stsfile)
- f = open(tmpfile,'r')
+ f = open_latin1(tmpfile,'r')
text = f.read()
f.close()
os.remove(tmpfile)
@@ -293,12 +295,12 @@ def _exec_command_python(command,
raise RuntimeError("%r failed" % (cmd,))
os.remove(cmdfile)
- f = open(stsfile,'r')
+ f = open_latin1(stsfile,'r')
status = int(f.read())
f.close()
os.remove(stsfile)
- f = open(outfile,'r')
+ f = open_latin1(outfile,'r')
text = f.read()
f.close()
os.remove(outfile)
@@ -390,14 +392,14 @@ def _exec_command( command, use_shell=None, use_tee = None, **env ):
os.dup2(se_dup,se_fileno)
fout.close()
- fout = open(outfile,'r')
+ fout = open_latin1(outfile,'r')
text = fout.read()
fout.close()
os.remove(outfile)
if using_command:
ferr.close()
- ferr = open(errfile,'r')
+ ferr = open_latin1(errfile,'r')
errmess = ferr.read()
ferr.close()
os.remove(errfile)