Skip to content

Commit

Permalink
Merge pull request #73 from JCSDA-internal/bugfix/rtd-config
Browse files Browse the repository at this point in the history
Configuration to enable processing git-lfs files on ReadTheDocs
  • Loading branch information
Mark Miesch authored Nov 10, 2020
2 parents ed2fd02 + 6149361 commit 33902fe
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down Expand Up @@ -172,4 +171,46 @@
]


# Workaround to install and execute git-lfs on Read the Docs
import os
import shutil
gitLfsVersion = "2.11.0"
if not shutil.which('git-lfs'):
print("Need to install and initialize git lfs")
tarFile = "git-lfs-linux-amd64-v" + gitLfsVersion + ".tar.gz"
downLoadUrl = "https://github.com/git-lfs/git-lfs/releases/download/v" + \
gitLfsVersion + "/" + tarFile
print(" tar file: ", tarFile)
print(" download URL: ", downLoadUrl)

# download git-lfs from github
osCmd = "wget " + downLoadUrl
os.system(osCmd)

# unpack the tar file
osCmd = "tar xvzf " + tarFile
os.system(osCmd)

# record the current working directory
cwd = os.getcwd()

# make lfs available in current repository
osCmd = cwd + "/git-lfs install"
os.system(osCmd)

# configure for lfs processes
osCmd = "git config filter.lfs.process '" + cwd + "/git-lfs filter-process'"
os.system(osCmd)
osCmd = "git config filter.lfs.smudge '" + cwd + "/git-lfs sumdge -- %f'"
os.system(osCmd)
osCmd = "git config filter.lfs.clean '" + cwd + "/git-lfs clean -- %f'"
os.system(osCmd)

# download content from remote
osCmd = cwd + "/git-lfs fetch"
os.system(osCmd)

# replace local files (links) with their real content
osCmd = cwd + "/git-lfs checkout"
os.system(osCmd)

0 comments on commit 33902fe

Please sign in to comment.