summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-28 15:38:24 -0300
committerdrebs <drebs@riseup.net>2017-09-28 15:38:24 -0300
commitb7812ea26162b5b24b27dab42d2bf89964fd39e2 (patch)
tree7959bc50fe623e7ca17ad0d3ac2a205fae412656
parent3a52f2a88a5423d1e8d76bb704d0164c9726fd07 (diff)
[doc] mock the pysqlcihper module on readthedocs
-rw-r--r--docs/conf.py14
-rw-r--r--setup.py11
2 files changed, 21 insertions, 4 deletions
diff --git a/docs/conf.py b/docs/conf.py
index c0351744..d997d17a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,6 +15,8 @@
import sys
import os
+from mock import Mock as MagicMock
+
# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -265,3 +267,15 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
+
+
+# -- Mock modules with C library dependencies ----------------------------
+# see: http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
+
+class Mock(MagicMock):
+ @classmethod
+ def __getattr__(cls, name):
+ return MagicMock()
+
+MOCK_MODULES = ['pysqlcipher']
+sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
diff --git a/setup.py b/setup.py
index 3f99cbce..916dc832 100644
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@
"""
Setup file for leap.soledad
"""
+import os
import re
import sys
import versioneer
@@ -83,10 +84,12 @@ client = [
]
# needed until kali merges the py3 fork back into the main pysqlcipher repo
-if sys.version_info.major >= 3:
- client += ['pysqlcipher3']
-else:
- client += ['pysqlcipher']
+readthedocs = bool(os.environ.get('READTHEDOCS'))
+if not readthedocs:
+ if sys.version_info.major >= 3:
+ client += ['pysqlcipher3']
+ else:
+ client += ['pysqlcipher']
server = [
'configparser',