-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71db820
commit b14d88c
Showing
1 changed file
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,14 @@ | |
# Stefan Appelhoff <[email protected]> | ||
# | ||
# License: BSD-3-Clause | ||
import os | ||
import glob | ||
from os import path as op | ||
import os | ||
import shutil | ||
import sys | ||
from os import path as op | ||
|
||
import sphinx.util | ||
from mne.utils import run_subprocess, _replace_md5 | ||
from mne.utils import hashfunc, run_subprocess | ||
|
||
|
||
def setup(app): | ||
|
@@ -116,6 +117,17 @@ def generate_cli_rst(app=None): | |
print("[Done]") | ||
|
||
|
||
def _replace_md5(fname): | ||
"""Replace a file based on MD5sum.""" | ||
# adapted from sphinx-gallery | ||
assert fname.endswith(".new") | ||
fname_old = fname[:-4] | ||
if os.path.isfile(fname_old) and hashfunc(fname) == hashfunc(fname_old): | ||
os.remove(fname) | ||
else: | ||
shutil.move(fname, fname_old) | ||
|
||
|
||
# This is useful for testing/iterating to see what the result looks like | ||
if __name__ == "__main__": | ||
generate_cli_rst() |