Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert renaming the config properties #62

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 13 additions & 27 deletions src/jupyterlite_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,33 +266,21 @@ def jupyterlite_build(app: Sphinx, error):
if app.builder.format == "html":
print("[jupyterlite-sphinx] Running JupyterLite build")

jupyter_lite_config = app.env.config.jupyter_lite_config
jupyter_lite_contents = app.env.config.jupyter_lite_contents
jupyter_lite_dir = app.env.config.jupyter_lite_dir

if app.env.config.jupyterlite_config:
warn(
"jupyterlite_config config option is deprecated, please use jupyter_lite_config instead"
)
jupyter_lite_config = app.env.config.jupyterlite_config

if app.env.config.jupyterlite_dir:
warn(
"jupyterlite_dir config option is deprecated, please use jupyter_lite_dir instead"
)
jupyter_lite_dir = app.env.config.jupyterlite_dir
jupyterlite_config = app.env.config.jupyterlite_config
jupyterlite_contents = app.env.config.jupyterlite_contents
jupyterlite_dir = app.env.config.jupyterlite_dir

config = []
if jupyter_lite_config:
config = ["--config", jupyter_lite_config]
if jupyterlite_config:
config = ["--config", jupyterlite_config]

contents = []
if jupyter_lite_contents:
if isinstance(jupyter_lite_contents, str):
contents.extend(["--contents", jupyter_lite_contents])
if jupyterlite_contents:
if isinstance(jupyterlite_contents, str):
contents.extend(["--contents", jupyterlite_contents])

if isinstance(jupyter_lite_contents, (tuple, list)):
for content in jupyter_lite_contents:
if isinstance(jupyterlite_contents, (tuple, list)):
for content in jupyterlite_contents:
contents.extend(["--contents", content])

command = [
Expand All @@ -308,8 +296,8 @@ def jupyterlite_build(app: Sphinx, error):
os.path.join(app.outdir, JUPYTERLITE_DIR),
]

if jupyter_lite_dir:
command.extend(["--lite-dir", jupyter_lite_dir])
if jupyterlite_dir:
command.extend(["--lite-dir", jupyterlite_dir])

subprocess.run(command, check=True)
else:
Expand Down Expand Up @@ -338,10 +326,8 @@ def setup(app):

# Config options
app.add_config_value("jupyterlite_config", None, rebuild="html")
app.add_config_value("jupyter_lite_config", None, rebuild="html")
app.add_config_value("jupyterlite_dir", None, rebuild="html")
app.add_config_value("jupyter_lite_dir", None, rebuild="html")
app.add_config_value("jupyter_lite_contents", None, rebuild="html")
app.add_config_value("jupyterlite_contents", None, rebuild="html")

# Initialize RetroLite and JupyterLite directives
app.add_node(
Expand Down