Skip to content

Commit d14e358

Browse files
authored
Fix direct sphinx build. (#127)
* Fix direct sphinx build. * Fix source code linker for python sphinx build --------- Signed-off-by: Nicolae Dicu <[email protected]>
1 parent c24f4d8 commit d14e358

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/extensions/score_plantuml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_runfiles_dir() -> Path:
5353
# But we need to find it first.
5454
logger.debug("Running outside bazel.")
5555

56-
git_root = Path(__file__).resolve()
56+
git_root = Path.cwd().resolve()
5757
while not (git_root / ".git").exists():
5858
git_root = git_root.parent
5959
if git_root == Path("/"):

src/extensions/score_source_code_linker/generate_source_code_links_json.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ def find_git_root(start_path: str | Path = "") -> Path | None:
4040
start_path = __file__
4141

4242
git_root = Path(start_path).resolve()
43+
esbonio_search = False
4344
while not (git_root / ".git").exists():
4445
git_root = git_root.parent
4546
if git_root == Path("/"):
46-
return None
47+
# fallback to cwd when building with python -m sphinx docs _build -T
48+
if esbonio_search:
49+
return None
50+
git_root = Path.cwd().resolve()
51+
esbonio_search = True
4752
return git_root
4853

4954

0 commit comments

Comments
 (0)