|
13 | 13 | # serve to show the default.
|
14 | 14 |
|
15 | 15 | import os
|
| 16 | +from pathlib import Path |
| 17 | +from tempfile import TemporaryDirectory |
| 18 | +import shutil |
16 | 19 | from packaging.version import Version
|
17 | 20 | import nipype
|
| 21 | +import subprocess as sp |
18 | 22 |
|
19 |
| -doc_path = os.path.abspath(os.path.dirname(__file__)) |
20 |
| -os.makedirs('users/examples', exist_ok=True) |
21 | 23 |
|
22 |
| -os.chdir(os.path.join(doc_path, 'users', 'examples')) |
23 |
| -os.system("""python ../../../tools/ex2rst -x ../../../examples/test_spm.py \ |
24 |
| ---project Nipype --outdir . ../../../examples""") |
25 |
| -os.system("""python ../../../tools/ex2rst --project Nipype --outdir . \ |
26 |
| -../../../examples/frontiers_paper""") |
27 |
| -os.chdir(doc_path) |
| 24 | +conf_py = Path(__file__) |
| 25 | + |
| 26 | +example_dir = conf_py.parent / 'users' / 'examples' |
| 27 | +shutil.rmtree(example_dir, ignore_errors=True) |
| 28 | +example_dir.mkdir(parents=True) |
| 29 | +python_dir = conf_py.parent / "_static" / "python" |
| 30 | +shutil.rmtree(python_dir, ignore_errors=True) |
| 31 | + |
| 32 | +ex2rst = str(conf_py.parent.parent / "tools" / "ex2rst") |
| 33 | + |
| 34 | +with TemporaryDirectory() as tmpdir: |
| 35 | + sp.run(["git", "clone", "--depth", "1", "https://github.com/niflows/nipype1-examples.git", |
| 36 | + tmpdir], check=True) |
| 37 | + source_dir = Path(tmpdir) / "package" / "niflow" / "nipype1" / "examples" |
| 38 | + shutil.copytree(source_dir, python_dir) |
| 39 | + |
| 40 | +sp.run(["python", ex2rst, "--project", "Nipype", "--outdir", str(example_dir), |
| 41 | + "-x", str(python_dir / "test_spm.py"), |
| 42 | + "-x", str(python_dir / "__init__.py"), |
| 43 | + "-x", str(python_dir / "cli.py"), |
| 44 | + str(python_dir)], check=True) |
| 45 | +sp.run(["python", ex2rst, "--project", "Nipype", "--outdir", str(example_dir), |
| 46 | + str(python_dir / "frontiers_paper")], check=True) |
28 | 47 |
|
29 | 48 |
|
30 | 49 | # If extensions (or modules to document with autodoc) are in another directory,
|
|
98 | 117 |
|
99 | 118 | # General information about the project.
|
100 | 119 | project = u'nipype'
|
101 |
| -copyright = u'2009-19, Neuroimaging in Python team' |
| 120 | +copyright = u'2009-20, Neuroimaging in Python team' |
102 | 121 |
|
103 | 122 | # The version info for the project you're documenting, acts as replacement for
|
104 | 123 | # |version| and |release|, also used in various other places throughout the
|
|
0 commit comments