File tree 3 files changed +35
-0
lines changed
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import argparse
4
4
from pathlib import Path
5
+ import shutil
5
6
6
7
from sphinx .application import Sphinx
7
8
@@ -22,6 +23,16 @@ def create_parser():
22
23
return parser .parse_args ()
23
24
24
25
26
+ def create_index_file (html_content : Path ):
27
+ pep_zero_html = html_content / "pep-0000.html"
28
+ pep_zero_dir = html_content / "pep-0000" / "index.html"
29
+
30
+ if pep_zero_html .is_file ():
31
+ shutil .copy (pep_zero_html , html_content / "index.html" )
32
+ elif pep_zero_dir .is_file ():
33
+ shutil .copy (pep_zero_dir , html_content / "index.html" )
34
+
35
+
25
36
if __name__ == "__main__" :
26
37
args = create_parser ()
27
38
@@ -52,3 +63,6 @@ def create_parser():
52
63
)
53
64
app .builder .copysource = False # Prevent unneeded source copying - we link direct to GitHub
54
65
app .build ()
66
+
67
+ if args .index_file :
68
+ create_index_file (build_directory )
Original file line number Diff line number Diff line change 1
1
"""Configuration for building PEPs using Sphinx."""
2
2
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ sys .path .append (str (Path ("pep_sphinx_extensions" ).absolute ()))
7
+
3
8
# -- Project information -----------------------------------------------------
4
9
5
10
project = "PEPs"
6
11
master_doc = "contents"
7
12
8
13
# -- General configuration ---------------------------------------------------
9
14
15
+ # Add any Sphinx extension module names here, as strings.
16
+ extensions = ["pep_sphinx_extensions" ]
17
+
10
18
# The file extensions of source files. Sphinx uses these suffixes as sources.
11
19
source_suffix = {
12
20
".rst" : "restructuredtext" ,
Original file line number Diff line number Diff line change
1
+ """Sphinx extensions for performant PEP processing"""
2
+
3
+ from sphinx .application import Sphinx
4
+
5
+ from pep_sphinx_extensions .pep_zero_generator .pep_index_generator import create_pep_zero
6
+
7
+
8
+ def setup (app : Sphinx ) -> dict :
9
+ """Initialise Sphinx extension."""
10
+
11
+ app .connect ("env-before-read-docs" , create_pep_zero ) # PEP 0 hook
12
+
13
+ return {"parallel_read_safe" : True , "parallel_write_safe" : True }
You can’t perform that action at this time.
0 commit comments