summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sphinx/ext/autosummary/generate.py3
-rw-r--r--sphinx/pycode/__init__.py3
-rw-r--r--sphinx/websupport/__init__.py2
3 files changed, 5 insertions, 3 deletions
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py
index c1eb2ac5..de1578a2 100644
--- a/sphinx/ext/autosummary/generate.py
+++ b/sphinx/ext/autosummary/generate.py
@@ -27,6 +27,7 @@ import optparse
from jinja2 import FileSystemLoader, TemplateNotFound
from jinja2.sandbox import SandboxedEnvironment
+from sphinx import package_dir
from sphinx.ext.autosummary import import_by_name, get_documenter
from sphinx.jinja2glue import BuiltinTemplateLoader
from sphinx.util.osutil import ensuredir
@@ -78,7 +79,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
sources = [os.path.join(base_path, filename) for filename in sources]
# create our own templating environment
- template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')]
+ template_dirs = [os.path.join(package_dir, 'ext', 'autosummary', 'templates')]
if builder is not None:
# allow the user to override the templates
template_loader = BuiltinTemplateLoader()
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py
index 09f7e220..ef626f6d 100644
--- a/sphinx/pycode/__init__.py
+++ b/sphinx/pycode/__init__.py
@@ -11,6 +11,7 @@
from os import path
+from sphinx import package_dir
from sphinx.errors import PycodeError
from sphinx.pycode import nodes
from sphinx.pycode.pgen2 import driver, token, tokenize, parse, literals
@@ -20,7 +21,7 @@ from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc
# load the Python grammar
-_grammarfile = path.join(path.dirname(__file__), 'Grammar.txt')
+_grammarfile = path.join(package_dir, 'pycode', 'Grammar.txt')
pygrammar = driver.load_grammar(_grammarfile)
pydriver = driver.Driver(pygrammar, convert=nodes.convert)
diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py
index e054812e..61b63cab 100644
--- a/sphinx/websupport/__init__.py
+++ b/sphinx/websupport/__init__.py
@@ -87,7 +87,7 @@ class WebSupport(object):
def _init_templating(self):
import sphinx
- template_path = path.join(path.dirname(sphinx.__file__),
+ template_path = path.join(sphinx.package_dir,
'themes', 'basic')
loader = FileSystemLoader(template_path)
self.template_env = Environment(loader=loader)