Skip to content

Commit d601267

Browse files
committed
Add jupyterlite_contents config
1 parent 843f2da commit d601267

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/jupyterlite_sphinx.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ def run(self):
161161

162162
# Copy the Notebook for RetroLite to find
163163
os.makedirs(os.path.dirname(notebooks_dir), exist_ok=True)
164-
shutil.copyfile(notebook, str(notebooks_dir))
164+
try:
165+
shutil.copyfile(notebook, str(notebooks_dir))
166+
except shutil.SameFileError:
167+
pass
165168
else:
166169
notebook_name = None
167170

@@ -214,6 +217,11 @@ def jupyterlite_build(app: Sphinx, error):
214217
if app.env.config.jupyterlite_config:
215218
config = ["--config", app.env.config.jupyterlite_config]
216219

220+
contents = []
221+
if app.env.config.jupyterlite_contents:
222+
for content in app.env.config.jupyterlite_contents:
223+
contents.extend(["--contents", content])
224+
217225
with tempfile.TemporaryDirectory() as tmp_dir:
218226
subprocess.check_output(
219227
[
@@ -222,6 +230,7 @@ def jupyterlite_build(app: Sphinx, error):
222230
"build",
223231
"--debug",
224232
*config,
233+
*contents,
225234
"--lite-dir",
226235
tmp_dir,
227236
"--contents",
@@ -248,6 +257,7 @@ def setup(app):
248257

249258
# Config options
250259
app.add_config_value("jupyterlite_config", None, rebuild="html")
260+
app.add_config_value("jupyterlite_contents", None, rebuild="html")
251261

252262
# Initialize RetroLite and JupyterLite directives
253263
app.add_node(

0 commit comments

Comments
 (0)