#265: restore Jython compatibility.

This commit is contained in:
Georg Brandl
2009-11-08 17:00:56 +01:00
parent adad88b429
commit b0ee528298
2 changed files with 12 additions and 2 deletions

View File

@@ -12,9 +12,14 @@
import sys
import cgi
import re
import parser
import textwrap
try:
import parser
except ImportError:
# parser is not available on Jython
parser = None
from sphinx.util.texescape import tex_hl_escape_map
try:
@@ -155,6 +160,9 @@ class PygmentsBridge(object):
# just replace all non-ASCII characters.
src = src.encode('ascii', 'replace')
if parser is None:
return True
try:
parser.suite(src)
except parsing_exceptions:

View File

@@ -14,6 +14,7 @@ import re
import sys
import stat
import time
import errno
import types
import shutil
import fnmatch
@@ -67,7 +68,8 @@ def ensuredir(path):
try:
os.makedirs(path)
except OSError, err:
if not err.errno == 17:
# 0 for Jython/Win32
if err.errno not in [0, getattr(errno, 'EEXIST', 0)]:
raise