summaryrefslogtreecommitdiff
path: root/sphinx/pycode/pgen2/driver.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-10 21:07:51 +0100
committerGeorg Brandl <georg@python.org>2014-01-10 21:07:51 +0100
commit4c91a7a1d2904dbc3fa1afe579b8714f0cfdbaba (patch)
treeb8ec81e6de98cb8ae03abbe0739e056cc4cfbcff /sphinx/pycode/pgen2/driver.py
parent7a26dd07301b5e612c3368539ceb579af622167f (diff)
downloadsphinx-git-4c91a7a1d2904dbc3fa1afe579b8714f0cfdbaba.tar.gz
Closes #641: use Sphinx version in cache pickle filename.
Diffstat (limited to 'sphinx/pycode/pgen2/driver.py')
-rw-r--r--sphinx/pycode/pgen2/driver.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sphinx/pycode/pgen2/driver.py b/sphinx/pycode/pgen2/driver.py
index 5e6cf9a5b..e9e907dcc 100644
--- a/sphinx/pycode/pgen2/driver.py
+++ b/sphinx/pycode/pgen2/driver.py
@@ -18,7 +18,8 @@ __all__ = ["Driver", "load_grammar"]
# Python imports
import os
import logging
-import sys
+
+import sphinx
# Pgen imports
from sphinx.pycode.pgen2 import grammar, parse, token, tokenize, pgen
@@ -120,7 +121,8 @@ def load_grammar(gt="Grammar.txt", gp=None,
head, tail = os.path.splitext(gt)
if tail == ".txt":
tail = ""
- gp = head + tail + ".".join(map(str, sys.version_info[:2])) + ".pickle"
+ # embed Sphinx major version for the case we ever change the grammar...
+ gp = head + tail + ".".join(map(str, sphinx.version_info[:2])) + ".pickle"
if force or not _newer(gp, gt):
logger.info("Generating grammar tables from %s", gt)
g = pgen.generate_grammar(gt)