|
21 | 21 | # import sys |
22 | 22 | # sys.path.insert(0, os.path.abspath('.')) |
23 | 23 |
|
24 | | - |
25 | 24 | # -- General configuration ------------------------------------------------ |
26 | 25 |
|
27 | 26 | # If your documentation needs a minimal Sphinx version, state it here. |
|
172 | 171 | ] |
173 | 172 |
|
174 | 173 |
|
| 174 | +# Workaround to install and execute git-lfs on Read the Docs |
| 175 | +import os |
| 176 | +import shutil |
| 177 | +gitLfsVersion = "2.11.0" |
| 178 | +if not shutil.which('git-lfs'): |
| 179 | + print("Need to install and initialize git lfs") |
| 180 | + tarFile = "git-lfs-linux-amd64-v" + gitLfsVersion + ".tar.gz" |
| 181 | + downLoadUrl = "https://github.com/git-lfs/git-lfs/releases/download/v" + \ |
| 182 | + gitLfsVersion + "/" + tarFile |
| 183 | + print(" tar file: ", tarFile) |
| 184 | + print(" download URL: ", downLoadUrl) |
| 185 | + |
| 186 | + # download git-lfs from github |
| 187 | + osCmd = "wget " + downLoadUrl |
| 188 | + os.system(osCmd) |
| 189 | + |
| 190 | + # unpack the tar file |
| 191 | + osCmd = "tar xvzf " + tarFile |
| 192 | + os.system(osCmd) |
| 193 | + |
| 194 | + # record the current working directory |
| 195 | + cwd = os.getcwd() |
| 196 | + |
| 197 | + # make lfs available in current repository |
| 198 | + osCmd = cwd + "/git-lfs install" |
| 199 | + os.system(osCmd) |
| 200 | + |
| 201 | + # configure for lfs processes |
| 202 | + osCmd = "git config filter.lfs.process '" + cwd + "/git-lfs filter-process'" |
| 203 | + os.system(osCmd) |
| 204 | + osCmd = "git config filter.lfs.smudge '" + cwd + "/git-lfs sumdge -- %f'" |
| 205 | + os.system(osCmd) |
| 206 | + osCmd = "git config filter.lfs.clean '" + cwd + "/git-lfs clean -- %f'" |
| 207 | + os.system(osCmd) |
| 208 | + |
| 209 | + # download content from remote |
| 210 | + osCmd = cwd + "/git-lfs fetch" |
| 211 | + os.system(osCmd) |
| 212 | + |
| 213 | + # replace local files (links) with their real content |
| 214 | + osCmd = cwd + "/git-lfs checkout" |
| 215 | + os.system(osCmd) |
175 | 216 |
|
0 commit comments