|
From: <mi...@us...> - 2021-11-15 17:56:00
|
Revision: 8888
http://sourceforge.net/p/docutils/code/8888
Author: milde
Date: 2021-11-15 17:55:57 +0000 (Mon, 15 Nov 2021)
Log Message:
-----------
odt writer: Fix spurious output with Windows (bug #350).
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-11-15 17:55:50 UTC (rev 8887)
+++ trunk/docutils/HISTORY.txt 2021-11-15 17:55:57 UTC (rev 8888)
@@ -29,6 +29,10 @@
- Fix typo (bug #432).
+* docutils/writers/odf_odt/__init__.py:
+
+ - Fix spurious output with Windows (bug #350).
+
Release 0.18 (2021-10-26)
=========================
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2021-11-15 17:55:50 UTC (rev 8887)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2021-11-15 17:55:57 UTC (rev 8888)
@@ -16,6 +16,7 @@
import os
import os.path
import re
+import subprocess
import sys
import tempfile
import time
@@ -45,7 +46,9 @@
from StringIO import StringIO
from urllib2 import HTTPError
from urllib2 import urlopen
+ FileNotFoundError = OSError
+
# Import pygments and odtwriter pygments formatters if possible.
try:
import pygments
@@ -1087,13 +1090,13 @@
def setup_paper(self, root_el):
try:
- fin = os.popen("paperconf -s 2> /dev/null")
- dimensions = fin.read().split()
- w, h = (float(s) for s in dimensions)
- except (IOError, ValueError):
+ dimensions = subprocess.check_output(('paperconf', '-s'),
+ stderr=subprocess.STDOUT)
+ w, h = (float(s) for s in dimensions.split())
+ except (subprocess.CalledProcessError, FileNotFoundError, ValueError):
+ self.document.reporter.info(
+ 'Cannot use `paperconf`, defaulting to Letter.')
w, h = 612, 792 # default to Letter
- finally:
- fin.close()
def walk(el):
if el.tag == "{%s}page-layout-properties" % SNSD["style"] and \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|