Skip to content

Commit

Permalink
fix broken mne import
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed May 28, 2024
1 parent 71db820 commit b14d88c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions doc/sphinxext/gen_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# 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):
Expand Down Expand Up @@ -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()

0 comments on commit b14d88c

Please sign in to comment.