Skip to content

Commit f76dc43

Browse files
committed
BUG: Tarball html output path when not built as a remote module
1 parent d19ecc3 commit f76dc43

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Utilities/CreateTarball.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@
1414
import sys
1515
import tarfile
1616
import zipfile
17+
from pathlib import Path
1718

1819

1920
if len(sys.argv) != 3:
2021
print("usage: " + sys.argv[0] + " <example_name> <SPHINX_DESTINATION>")
2122
sys.exit(1)
2223

2324
# Collect our directories.
24-
cwd = os.getcwd()
25+
cwd = Path(os.getcwd())
26+
2527
example_name = sys.argv[1]
26-
example_dir = os.path.join(cwd, example_name)
27-
example_idx = example_dir.index("SphinxExamples") + 15
28-
html_output_dir = os.path.join(sys.argv[2], "html", example_dir[example_idx:])
28+
base_dir = cwd.parent.parent.parent
29+
example_relative_path = cwd.relative_to(base_dir) / example_name
30+
html_output_dir = str(Path(sys.argv[2]) / "html" / example_relative_path)
2931

3032
if not os.path.exists(html_output_dir):
3133
os.makedirs(html_output_dir)

0 commit comments

Comments
 (0)