|
3 | 3 | from datetime import date, datetime |
4 | 4 | from pathlib import Path |
5 | 5 |
|
6 | | -import sphinx_rtd_theme |
7 | | - |
8 | 6 | from virtualenv.version import __version__ |
9 | 7 |
|
10 | 8 | company = "PyPA" |
|
30 | 28 | project = name |
31 | 29 | today_fmt = "%B %d, %Y" |
32 | 30 |
|
33 | | -html_theme = "sphinx_rtd_theme" |
34 | | -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
35 | | -html_theme_options = { |
36 | | - "canonical_url": "https://virtualenv.pypa.io/", |
37 | | - "logo_only": False, |
38 | | - "display_version": True, |
39 | | - "prev_next_buttons_location": "bottom", |
40 | | - "collapse_navigation": False, |
41 | | - "sticky_navigation": True, |
42 | | - "navigation_depth": 6, |
43 | | - "includehidden": True, |
44 | | -} |
45 | | -html_static_path = ["_static"] |
46 | | -html_last_updated_fmt = datetime.now().isoformat() |
47 | | -htmlhelp_basename = "Pastedoc" |
| 31 | +html_theme = "furo" |
| 32 | +html_title, html_last_updated_fmt = "tox", datetime.now().isoformat() |
| 33 | +pygments_style, pygments_dark_style = "sphinx", "monokai" |
| 34 | +html_static_path, html_css_files = ["_static"], ["custom.css"] |
| 35 | + |
48 | 36 | autoclass_content = "both" # Include __init__ in class documentation |
49 | 37 | autodoc_member_order = "bysource" |
50 | 38 | autosectionlabel_prefix_document = True |
|
57 | 45 | } |
58 | 46 |
|
59 | 47 |
|
60 | | -def generate_draft_news(): |
61 | | - root = Path(__file__).parents[1] |
62 | | - new = subprocess.check_output( |
63 | | - [sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"], |
64 | | - cwd=root, |
65 | | - text=True, |
66 | | - ) |
67 | | - dest = root / "docs" / "_draft.rst" |
68 | | - dest.write_text("" if "No significant changes" in new else new) |
69 | | - |
70 | | - |
71 | | -generate_draft_news() |
72 | | - |
73 | | - |
74 | 48 | def setup(app): |
| 49 | + here = Path(__file__).parent |
| 50 | + root, exe = here.parent, Path(sys.executable) |
| 51 | + towncrier = exe.with_name(f"towncrier{exe.suffix}") |
| 52 | + cmd = [str(towncrier), "build", "--draft", "--version", "NEXT"] |
| 53 | + new = subprocess.check_output(cmd, cwd=root, text=True, stderr=subprocess.DEVNULL) |
| 54 | + (root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new) |
| 55 | + |
75 | 56 | # the CLI arguments are dynamically generated |
76 | 57 | doc_tree = Path(app.doctreedir) |
77 | 58 | cli_interface_doctree = doc_tree / "cli_interface.doctree" |
|
0 commit comments