MCPcopy
hub / github.com/mne-tools/mne-python / make_version

Function make_version

doc/conf.py:1734–1748  ·  view source on GitHub ↗

Make a text file with the git version.

(app, exception)

Source from the content-addressed store, hash-verified

1732
1733
1734def make_version(app, exception):
1735 """Make a text file with the git version."""
1736 if not (
1737 isinstance(app.builder, sphinx.builders.html.StandaloneHTMLBuilder)
1738 and exception is None
1739 ):
1740 return
1741 try:
1742 stdout, _ = run_subprocess(["git", "rev-parse", "HEAD"], verbose=False)
1743 except Exception as exc:
1744 sphinx_logger.warning(f"Failed to write _version.txt: {exc}")
1745 return
1746 with open(os.path.join(app.outdir, "_version.txt"), "w") as fid:
1747 fid.write(stdout)
1748 sphinx_logger.info(f'Added "{stdout.rstrip()}" > _version.txt')
1749
1750
1751# -- Connect our handlers to the main Sphinx app ---------------------------

Callers

nothing calls this directly

Calls 3

run_subprocessFunction · 0.90
writeMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected