mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#265: restore Jython compatibility.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user