|
19 | 19 | import os
|
20 | 20 | import json
|
21 | 21 |
|
22 |
| -RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower()) |
23 |
| - |
24 | 22 | # -- Project information -----------------------------------------------------
|
25 | 23 |
|
26 | 24 | project = 'itkwidgets'
|
|
38 | 36 | # ones.
|
39 | 37 | extensions = ['myst_parser',]
|
40 | 38 |
|
41 |
| -here = Path(__file__).parent.resolve() |
42 |
| -jupyterlite_config = here / "jupyterlite_config.json" |
43 |
| - |
44 | 39 | html_theme_options = dict(
|
45 | 40 | github_url='https://github.com/InsightSoftwareConsortium/itkwidgets'
|
46 | 41 | )
|
|
67 | 62 | # relative to this directory. They are copied after the builtin static files,
|
68 | 63 | # so a file named "default.css" will overwrite the builtin "default.css".
|
69 | 64 | html_static_path = ['_static',
|
70 |
| - '_output'] |
71 |
| - |
72 |
| -def jupyterlite_build(app: Sphinx): |
73 |
| - from pprint import pprint |
74 |
| - pprint('jupyterlite_build') |
75 |
| - pprint(app) |
76 |
| - pprint(app.builder) |
77 |
| - if app.builder: |
78 |
| - pprint(app.builder.format) |
79 |
| - if app.builder and app.builder.format == "html": |
80 |
| - subprocess.check_call(['jupyter', 'lite', 'build', '--config', |
81 |
| - str(jupyterlite_config)], cwd=str(here)) |
| 65 | + 'jupyterlite/_output'] |
| 66 | + |
| 67 | +def jupyterlite_build(app: Sphinx, error): |
| 68 | + here = Path(__file__).parent.resolve() |
| 69 | + jupyterlite_config = here / "jupyterlite" / "jupyterlite_config.json" |
| 70 | + subprocess.check_call(['jupyter', 'lite', 'build', '--config', |
| 71 | + str(jupyterlite_config)], cwd=str(here / 'jupyterlite')) |
82 | 72 |
|
83 | 73 | def setup(app):
|
84 |
| - # For local builds, run jupyter lite build manually |
| 74 | + # For local builds, you can run jupyter lite build manually |
| 75 | + # $ cd jupyterlite |
85 | 76 | # $ jupyter lite serve --config ./jupyterlite_config.json
|
86 |
| - if RTD: |
87 |
| - app.connect("builder-inited", jupyterlite_build) |
| 77 | + app.connect("config-inited", jupyterlite_build) |
0 commit comments