Skip to content

Commit

Permalink
Add git-lfs support in RTD environment
Browse files Browse the repository at this point in the history
Requires tweaking upstream RTD settings to install from pip. This logic
was pulled from a discussion here:

readthedocs/readthedocs.org#1846
  • Loading branch information
msheiny committed Jun 26, 2018
1 parent 5ad62e8 commit 792312f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ update-pip-requirements: ## Updates all Python requirements files via pip-compil
securedrop/requirements/test-requirements.in
pip-compile --output-file securedrop/requirements/securedrop-app-code-requirements.txt \
securedrop/requirements/securedrop-app-code-requirements.in
pip-compile --output-file securedrop/requirements/rtd-requirements.txt \
securedrop/requirements/rtd-requirements.in

.PHONY: libvirt-share
libvirt-share: ## Configure ACLs to allow RWX for libvirt VM (e.g. Admin Workstation)
Expand Down
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# https://docs.readthedocs.org/en/latest/faq.html#how-do-i-change-behavior-for-read-the-docs
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# Get SD root directory
docs_dir = os.path.dirname(os.path.abspath(__file__))
sd_root_dir = os.path.abspath(os.path.join(docs_dir,'../'))

# 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.
Expand Down Expand Up @@ -112,6 +116,10 @@
# a list of builtin themes.
if on_rtd:
html_theme = 'default'

print('Fetching files with git_lfs')
from git_lfs import fetch
fetch(sd_root_dir)
else:
try:
# If you want to build the docs locally using the RTD theme,
Expand Down
4 changes: 4 additions & 0 deletions securedrop/requirements/rtd-requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git-lfs
sphinx
sphinx-autobuild
sphinx_rtd_theme
36 changes: 36 additions & 0 deletions securedrop/requirements/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file securedrop/requirements/rtd-requirements.txt securedrop/requirements/rtd-requirements.in
#
alabaster==0.7.11 # via sphinx
argh==0.26.2 # via sphinx-autobuild, watchdog
babel==2.6.0 # via sphinx
certifi==2018.4.16 # via requests
chardet==3.0.4 # via requests
docutils==0.14 # via sphinx
git-lfs==1.5
idna==2.7 # via requests
imagesize==1.0.0 # via sphinx
jinja2==2.10 # via sphinx
livereload==2.5.2 # via sphinx-autobuild
markupsafe==1.0 # via jinja2
packaging==17.1 # via sphinx
pathtools==0.1.2 # via sphinx-autobuild, watchdog
port-for==0.3.1 # via sphinx-autobuild
pygments==2.2.0 # via sphinx
pyparsing==2.2.0 # via packaging
pytz==2018.4 # via babel
pyyaml==3.12 # via sphinx-autobuild, watchdog
requests==2.19.1 # via sphinx
six==1.11.0 # via livereload, packaging, sphinx
snowballstemmer==1.2.1 # via sphinx
sphinx-autobuild==0.7.1
sphinx-rtd-theme==0.4.0
sphinx==1.7.5
sphinxcontrib-websupport==1.1.0 # via sphinx
tornado==5.0.2 # via livereload, sphinx-autobuild
typing==3.6.4 # via sphinx
urllib3==1.23 # via requests
watchdog==0.8.3 # via sphinx-autobuild

0 comments on commit 792312f

Please sign in to comment.