Skip to content

Commit e8a17ae

Browse files
committed
Fix import for docs build script
1 parent ffc2079 commit e8a17ae

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/builddocs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
from pathlib import Path
2222
from typing import Tuple
2323

24-
from scripts.shared import execute_subprocess
24+
# Import execute_subprocess function from scripts.shared
25+
root = str(Path(__file__).resolve().parent.parent)
26+
old_path = sys.path.copy()
27+
sys.path.insert(0, root)
28+
try:
29+
from scripts.shared import execute_subprocess
30+
finally:
31+
# Restore original sys.path
32+
sys.path = old_path
2533

2634
NAME = "GeoCat Bridge"
2735
DEFAULT_DIR = "../build/docs"
@@ -313,7 +321,7 @@ def main():
313321
sep = '\n\t'
314322
print(f"Python paths:{sep}{f'{sep}'.join(sys.path)}")
315323
finally:
316-
if not result and not gh_ref and current and not has_edits:
324+
if result == 0 and not gh_ref and current and not has_edits:
317325
# Restore Git repo if there were no errors, the script was not triggered by a GitHub Action,
318326
# the name of the working branch could be determined and the original working branch was clean.
319327
print(f"Restoring initially checked out '{current}' branch...")

0 commit comments

Comments
 (0)