summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-10-07 19:17:48 +0200
committerGeorg Brandl <georg@python.org>2011-10-07 19:17:48 +0200
commitf435934e219d76edadbe342787d78e7c8915d20c (patch)
treeddb157a67f2c090236a0ec85be22339b5769e2ba
parenta49c13f08a85ad353d073f015ec446caaebb0ad5 (diff)
downloadsphinx-f435934e219d76edadbe342787d78e7c8915d20c.tar.gz
Activate the viewcode extension in the automatically generated apidoc project.
-rw-r--r--sphinx/apidoc.py1
-rw-r--r--sphinx/pycode/__init__.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py
index 5b6163dd..0885dc45 100644
--- a/sphinx/apidoc.py
+++ b/sphinx/apidoc.py
@@ -301,6 +301,7 @@ Note: By default this script will not overwrite already created files.""")
master = 'index',
epub = True,
ext_autodoc = True,
+ ext_viewcode = True,
makefile = True,
batchfile = True,
mastertocmaxdepth = opts.maxdepth,
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py
index ac840750..09f7e220 100644
--- a/sphinx/pycode/__init__.py
+++ b/sphinx/pycode/__init__.py
@@ -217,6 +217,7 @@ class ModuleAnalyzer(object):
pos = self.source.tell()
if not decoded:
self.encoding = detect_encoding(self.source.readline)
+ self.source.seek(pos)
self.code = self.source.read().decode(self.encoding)
self.source.seek(pos)
self.source = TextIOWrapper(self.source, self.encoding)