Revision: 8229
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8229&view=rev
Author: efiring
Date: 2010-04-14 22:44:13 + (Wed, 14 Apr 2010)
Log Message:
---
backend_ps: fix file perms when TeX is used; minor clarifications
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2010-04-14
18:48:36 UTC (rev 8228)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2010-04-14
22:44:13 UTC (rev 8229)
@@ -997,7 +997,6 @@
"""
isEPSF = format == 'eps'
passed_in_file_object = False
-fd, tmpfile = mkstemp()
if is_string_like(outfile):
title = outfile
elif is_writable_file_like(outfile):
@@ -1005,9 +1004,10 @@
passed_in_file_object = True
else:
raise ValueError("outfile must be a path or a file-like object")
-os.close(fd)
-fh = file(tmpfile, 'w')
+fd, tmpfile = mkstemp()
+fh = os.fdopen(fd, 'w')
+
# find the appropriate papertype
width, height = self.figure.get_size_inches()
if papertype == 'auto':
@@ -1153,12 +1153,11 @@
xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
if passed_in_file_object:
-fh = file(tmpfile)
+fh = open(tmpfile)
print >>outfile, fh.read()
else:
-f = open(outfile, 'w')
+open(outfile, 'w')
mode = os.stat(outfile).st_mode
-f.close()
shutil.move(tmpfile, outfile)
os.chmod(outfile, mode)
@@ -1175,8 +1174,7 @@
# write to a temp file, we'll move it to outfile when done
fd, tmpfile = mkstemp()
-os.close(fd)
-fh = file(tmpfile, 'w')
+fh = os.fdopen(fd, 'w')
self.figure.dpi = 72 # ignore the dpi kwarg
width, height = self.figure.get_size_inches()
@@ -1301,7 +1299,11 @@
if isinstance(outfile, file):
fh = file(tmpfile)
print >>outfile, fh.read()
-else: shutil.move(tmpfile, outfile)
+else:
+open(outfile, 'w')
+mode = os.stat(outfile).st_mode
+shutil.move(tmpfile, outfile)
+os.chmod(outfile, mode)
def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
paperWidth, paperHeight, orientation):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
Download IntelĀ® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins