Commits

Yuya Nishihara committed 0a2d89e

plantuml: add workaround for missing shebang of epstopdf command

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=607172

Comments (0)

Files changed (1)

plantuml/sphinxcontrib/plantuml.py

     :copyright: Copyright 2010 by Yuya Nishihara <yuya@tcha.org>.
     :license: BSD, see LICENSE for details.
 """
-import os, re, shlex, subprocess
+import errno, os, re, shlex, subprocess
 try:
     from hashlib import sha1
 except ImportError:  # Python<2.5
         args = list(self.builder.config.plantuml_epstopdf)
     args.append(fname)
     try:
-        p = subprocess.Popen(args, stdout=subprocess.PIPE,
-                             stderr=subprocess.PIPE)
+        try:
+            p = subprocess.Popen(args, stdout=subprocess.PIPE,
+                                 stderr=subprocess.PIPE)
+        except OSError, err:
+            # workaround for missing shebang of epstopdf script
+            if err.errno != getattr(errno, 'ENOEXEC', 0):
+                raise
+            p = subprocess.Popen(['bash'] + args, stdout=subprocess.PIPE,
+                                 stderr=subprocess.PIPE)
     except OSError, err:
         if err.errno != ENOENT:
             raise