File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 14
14
import sys
15
15
import tarfile
16
16
import zipfile
17
+ from pathlib import Path
17
18
18
19
19
20
if len (sys .argv ) != 3 :
20
21
print ("usage: " + sys .argv [0 ] + " <example_name> <SPHINX_DESTINATION>" )
21
22
sys .exit (1 )
22
23
23
24
# Collect our directories.
24
- cwd = os .getcwd ()
25
+ cwd = Path (os .getcwd ())
26
+
25
27
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 )
29
31
30
32
if not os .path .exists (html_output_dir ):
31
33
os .makedirs (html_output_dir )
You can’t perform that action at this time.
0 commit comments