Skip to content

Instantly share code, notes, and snippets.

@hansode
Created February 20, 2012 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hansode/1868055 to your computer and use it in GitHub Desktop.
Save hansode/1868055 to your computer and use it in GitHub Desktop.
Sphinx-1.1.2 Python-2.6 patch
$ uname -a
CYGWIN_NT-6.1 blueocean 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin
$ python --version
Python 2.6.5
$ make html
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.1.2
WARNING: the config value '__file__' is set to a string with non-ASCII characters; this can lead to Unicode errors occurring. Please use Unicode strings, e.g. u'Content'.
loading pickled environment... not yet created
building [html]: targets for 4 source files that are out of date
updating environment: 4 added, 0 changed, 0 removed
reading sources... [ 25%] cloud-client
Exception occurred:
File "/usr/lib/python2.6/site-packages/Sphinx-1.1.2-py2.6.egg/sphinx/environment.py", line 758, in read_doc
pub.set_source(None, src_path.encode(fs_encoding))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 73: ordinal not in range(128)
The full traceback has been saved in /tmp/sphinx-err-Cg4EMC.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1
diff -ur Sphinx-1.1.2-py2.6.egg-orig//sphinx/cmdline.py Sphinx-1.1.2-py2.6.egg//sphinx/cmdline.py
--- Sphinx-1.1.2-py2.6.egg-orig//sphinx/cmdline.py 2012-02-20 14:26:49.875362700 +0900
+++ Sphinx-1.1.2-py2.6.egg//sphinx/cmdline.py 2012-02-20 14:35:30.986942800 +0900
@@ -65,7 +65,7 @@
try:
opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:ng:NEqQWw:P')
allopts = set(opt[0] for opt in opts)
- srcdir = confdir = path.abspath(args[0])
+ srcdir = confdir = unicode(path.abspath(args[0]), sys.getfilesystemencoding())
if not path.isdir(srcdir):
print >>sys.stderr, 'Error: Cannot find source directory.'
return 1
@@ -74,7 +74,7 @@
print >>sys.stderr, ('Error: Source directory doesn\'t '
'contain conf.py file.')
return 1
- outdir = path.abspath(args[1])
+ outdir = unicode(path.abspath(args[1]), sys.getfilesystemencoding())
if not path.isdir(outdir):
print >>sys.stderr, 'Making output directory...'
os.makedirs(outdir)
Files Sphinx-1.1.2-py2.6.egg-orig//sphinx/cmdline.pyc and Sphinx-1.1.2-py2.6.egg//sphinx/cmdline.pyc differ
diff -ur Sphinx-1.1.2-py2.6.egg-orig//sphinx/config.py Sphinx-1.1.2-py2.6.egg//sphinx/config.py
--- Sphinx-1.1.2-py2.6.egg-orig//sphinx/config.py 2012-02-20 14:26:49.898364000 +0900
+++ Sphinx-1.1.2-py2.6.egg//sphinx/config.py 2012-02-20 14:34:51.096914000 +0900
@@ -186,7 +186,7 @@
self.values = Config.config_values.copy()
config = {}
if dirname is not None:
- config_file = path.join(dirname, filename)
+ config_file = path.join(dirname.encode(sys.getfilesystemencoding()), filename)
config['__file__'] = config_file
config['tags'] = tags
olddir = os.getcwd()
Files Sphinx-1.1.2-py2.6.egg-orig//sphinx/config.pyc and Sphinx-1.1.2-py2.6.egg//sphinx/config.pyc differ
diff -ur Sphinx-1.1.2-py2.6.egg-orig//sphinx/environment.py Sphinx-1.1.2-py2.6.egg//sphinx/environment.py
--- Sphinx-1.1.2-py2.6.egg-orig//sphinx/environment.py 2012-02-20 14:26:49.843360800 +0900
+++ Sphinx-1.1.2-py2.6.egg//sphinx/environment.py 2012-02-20 14:34:28.923749000 +0900
@@ -461,7 +461,7 @@
elif base is None:
return docname + suffix
else:
- return path.join(base, docname) + suffix
+ return path.join(base, docname.encode(sys.getfilesystemencoding())) + suffix
def relfn2path(self, filename, docname=None):
"""Return paths to a file referenced from a document, relative to
@@ -1315,7 +1315,7 @@
def _entries_from_toctree(toctreenode, separate=False, subtree=False):
"""Return TOC entries for a toctree node."""
- refs = [(e[0], str(e[1])) for e in toctreenode['entries']]
+ refs = [(e[0], e[1]) for e in toctreenode['entries']]
entries = []
for (title, ref) in refs:
try:
Files Sphinx-1.1.2-py2.6.egg-orig//sphinx/environment.pyc and Sphinx-1.1.2-py2.6.egg//sphinx/environment.pyc differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment