Skip to content

Commit

Permalink
Mock dependencies for readthedocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Onager committed Apr 23, 2015
1 parent 1b1eb2f commit c89f640
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import sys
import os
from mock import Mock as MagicMock
from plaso import dependencies

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -37,8 +39,19 @@
'sphinxcontrib.napoleon'
]

import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# There are a bunch of dependencies we can't install on readthedocs,
# so we need to mock them
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()

# Mock all the dependencies!
py_mods = [tup[0] for tup in dependencies.PYTHON_DEPENDENCIES]
bin_mods = [key for key, value in dependencies.LIBYAL_DEPENDENCIES.iteritems()]
sys.modules.update((mod_name, Mock()) for mod_name in py_mods)
sys.modules.update((mod_name, Mock()) for mod_name in bin_mods)


# Napoleon settings
napoleon_google_docstring = True
Expand Down

0 comments on commit c89f640

Please sign in to comment.