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

🐛 FIX: Path to custom output directory for _sources #346

Merged
merged 6 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sphinx_book_theme/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def add_hub_urls(
or context["sourcename"].endswith(".md.txt")
):
# Figure out the folders we want
build_dir = Path(app.outdir).parent
out_dir = Path(app.outdir)
build_dir = out_dir.parent
ntbk_dir = build_dir.joinpath("jupyter_execute")
sources_dir = build_dir.joinpath(context.get("builder", "html"), "_sources")
sources_dir = out_dir.joinpath("_sources")
# Paths to old and new notebooks
path_ntbk = ntbk_dir.joinpath(pagename).with_suffix(".ipynb")
path_new_notebook = sources_dir.joinpath(pagename).with_suffix(".ipynb")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,12 @@ def test_logo_only(sphinx_build_factory):
"h1", attrs={"id": "site-title"}
)
assert not logo_text


def test_copy_rendered_notebooks():
target = Path("build/outdir/_sources/section1/ntbkmd.ipynb")
if target.exists():
target.unlink()
# Switch to sphinx_build_factory if we figure out how to use outdir w/ it
check_call("sphinx-build -W -b dirhtml tests/sites/base build/outdir", shell=True)
choldgraf marked this conversation as resolved.
Show resolved Hide resolved
assert target.exists()