[Checkins] SVN: zopyx.convert2/trunk/ added support for $ZOPYX_CONVERT_SHELL

Andreas Jung andreas at andreas-jung.com
Mon Jul 19 01:31:04 EDT 2010


Log message for revision 114829:
  added support for $ZOPYX_CONVERT_SHELL 
  

Changed:
  U   zopyx.convert2/trunk/CHANGES.txt
  U   zopyx.convert2/trunk/README.txt
  U   zopyx.convert2/trunk/src/zopyx/convert2/fo.py
  U   zopyx.convert2/trunk/src/zopyx/convert2/fop.py
  U   zopyx.convert2/trunk/src/zopyx/convert2/prince.py
  U   zopyx.convert2/trunk/src/zopyx/convert2/util.py

-=-
Modified: zopyx.convert2/trunk/CHANGES.txt
===================================================================
--- zopyx.convert2/trunk/CHANGES.txt	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/CHANGES.txt	2010-07-19 05:31:03 UTC (rev 114829)
@@ -1,3 +1,7 @@
+2.2.1 (2010-07-19)
+==================
+- support $ZOPYX_CONVERT_SHELL 
+
 2.2.0 (2010-05-15)
 ==================
 - dedicated ConversionError exception added

Modified: zopyx.convert2/trunk/README.txt
===================================================================
--- zopyx.convert2/trunk/README.txt	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/README.txt	2010-07-19 05:31:03 UTC (rev 114829)
@@ -109,6 +109,20 @@
 - all converters are based on Java technology make the conversion solution
   highly portable across operating system (including Windows)
 
+Environment variables
+=====================
+
+The following environment variables can be used to resolve OS or distribution
+specific problems:
+
+``ZOPYX_CONVERT_SHELL`` - defaults to ``sh`` and is used to as shell command to
+execute external converters
+
+``ZOPYX_CONVERT_EXECUTION_MODE`` - default to ``process`` and refers to the
+method of Python executing external command (by default using the ``process`` module.
+Other value: ``system``, ``commands``
+
+
 Known issues
 ============
 

Modified: zopyx.convert2/trunk/src/zopyx/convert2/fo.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/fo.py	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/src/zopyx/convert2/fo.py	2010-07-19 05:31:03 UTC (rev 114829)
@@ -6,11 +6,11 @@
 
 import os
 import sys
-from elementtree.ElementTree import parse, tostring, SubElement        
+from elementtree.ElementTree import parse, tostring, SubElement
 
 from config import java
 from tidy import tidyhtml
-from util import newTempfile, runcmd, which, win32, checkEnvironment
+from util import newTempfile, runcmd, which, win32, checkEnvironment, execution_shell
 from logger import LOG
 from exceptions import ConversionError
 

Modified: zopyx.convert2/trunk/src/zopyx/convert2/fop.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/fop.py	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/src/zopyx/convert2/fop.py	2010-07-19 05:31:03 UTC (rev 114829)
@@ -8,7 +8,7 @@
 import sys
 
 from convert import BaseConverter
-from util import runcmd, which, win32, checkEnvironment, newTempfile
+from util import runcmd, which, win32, checkEnvironment, newTempfile, execution_shell
 from logger import LOG
 from exceptions import ConversionError
 
@@ -38,7 +38,8 @@
     if sys.platform == 'win32':
         cmd = '%s\\fop.bat -fo "%s" -pdf "%s"' % (fop_home, fo_filename, output_filename)
     else:
-        cmd = 'sh "%s/fop" -fo "%s" -pdf "%s"' % (fop_home, fo_filename, output_filename)
+        cmd = '%s "%s/fop" -fo "%s" -pdf "%s"' % \
+              (execution_shell, fop_home, fo_filename, output_filename)
 
     status, output = runcmd(cmd)
     if status != 0:

Modified: zopyx.convert2/trunk/src/zopyx/convert2/prince.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/prince.py	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/src/zopyx/convert2/prince.py	2010-07-19 05:31:03 UTC (rev 114829)
@@ -8,7 +8,7 @@
 import sys
 
 from convert import BaseConverter
-from util import runcmd, which, win32, checkEnvironment, newTempfile
+from util import runcmd, which, win32, checkEnvironment, newTempfile, execution_shell
 from logger import LOG
 
 from tidy import tidyhtml
@@ -40,7 +40,8 @@
     if sys.platform == 'win32':
         raise NotImplementedError('No support for PrinceXML on Windows available')
     else:
-        cmd = 'sh "prince" "%s" %s -o "%s"' % (html_filename, ' '.join(cmd_options), output_filename)
+        cmd = '%s "prince" "%s" %s -o "%s"' % \
+              (execution_shell, html_filename, ' '.join(cmd_options), output_filename)
     
     status, output = runcmd(cmd)
     if status != 0:

Modified: zopyx.convert2/trunk/src/zopyx/convert2/util.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/util.py	2010-07-18 19:07:42 UTC (rev 114828)
+++ zopyx.convert2/trunk/src/zopyx/convert2/util.py	2010-07-19 05:31:03 UTC (rev 114829)
@@ -14,6 +14,7 @@
 
 win32 = (sys.platform=='win32')
 execute_mode = os.environ.get('ZOPYX_CONVERT_EXECUTE_MODE', 'process')
+execution_shell = os.environ.get('ZOPYX_CONVERT_SHELL', 'sh')
 
 
 def newTempfile(suffix=''):



More information about the checkins mailing list