cesium-ml / cesium

Machine Learning Time-Series Platform
Other
671 stars 101 forks source link

Fix doc build by properly failing to import porterstemmer #126

Closed bnaul closed 8 years ago

bnaul commented 8 years ago

__import__ trickery makes blocks like this not work correctly (from sphinx.search.en):

try:
    # http://bitbucket.org/methane/porterstemmer/
    from porterstemmer import Stemmer as CStemmer
    CSTEMMER = True
    PYSTEMMER = False
except ImportError:
    CSTEMMER = False
    try:
        from Stemmer import Stemmer as PyStemmer
        PYSTEMMER = True
    except ImportError:
        from sphinx.util.stemmer import PorterStemmer
        PYSTEMMER = False

I added a special case for this which seems to have fixed it; this is the price of trying to auto-mock dependencies, I guess...

bnaul commented 8 years ago

I also thought about just installing porterstemmer since that's the first one it tries, but I think there's a actually a Sphinx bug. This is what I get when I remove the __import__ weirdness, pip install porterstemmer, and make json:

Exception occurred:
  File "/Users/brettnaul/anaconda/envs/mltsp3k/lib/python3.5/site-packages/sphinx/search/en.py", line 235, in init
    class Stemmer(CStemmer):
TypeError: type 'porterstemmer.Stemmer' is not an acceptable base type

Removing porterstemmer makes it compile correctly.

bnaul commented 8 years ago

Definitely a bug, I just filed an issue: https://github.com/sphinx-doc/sphinx/issues/2183

bnaul commented 8 years ago

Merging so I can make sure readthedocs is happy...

stefanv commented 8 years ago

:santa: