Skip to content

Commit 1aa44f0

Browse files
committed
Fix plugin index pages not being shown
Closes: #63
1 parent a6d5f24 commit 1aa44f0

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

src/pulp_docs/mkdocs_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
44
See: https://www.mkdocs.org/user-guide/configuration/#hooks
55
"""
6+
67
import re
78
from collections import defaultdict
8-
from typing import Union
99

1010
from bs4 import BeautifulSoup as bs
1111
from mkdocs.structure.nav import Page, Section

src/pulp_docs/mkdocs_macros.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,17 @@ def _place_doc_files(src_dir: Path, docs_dir: Path, repo: Repo, api_src_dir: Pat
198198
repo.status.has_staging_docs = False
199199

200200
# Add index pages to User and Dev sections
201-
for index_file in (docs_dir / "index.md", docs_dir / "docs/dev/index.md"):
202-
with suppress(FileNotFoundError):
203-
if not index_file.exists():
204-
index_file.write_text(
205-
f"# Welcome to {repo.title}\n\nThis is a generated page. "
206-
"See how to add a custom overview page for you plugin "
207-
"[here](site:pulp-docs/docs/dev/guides/create-plugin-overviews/)."
208-
)
201+
main_index = docs_dir / "docs/index.md"
202+
dev_index = docs_dir / "docs/dev/index.md"
203+
for index_file in (main_index, dev_index):
204+
if not index_file.exists() and index_file.parent.exists():
205+
index_file.write_text(
206+
f"# Welcome to {repo.title}\n\nThis is a generated page. "
207+
"See how to add a custom overview page for you plugin "
208+
"[here](site:pulp-docs/docs/dev/guides/create-plugin-overviews/)."
209+
)
210+
# clean index url: pulpcore/docs/ -> pulpcore
211+
shutil.move(main_index, main_index.parent.parent)
209212

210213
# Setup section pages (for better urls)
211214
if repo.name == SECTION_REPO:

src/pulp_docs/openapi.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Module for generating open-api json files for selected Pulp plugins.
33
"""
4+
45
import argparse
56
import os
67
import shutil
@@ -95,7 +96,11 @@ def setup_venv(self, plugin: PulpPlugin):
9596
Creates virtualenv with plugin.
9697
"""
9798
create_venv_cmd = ("python", "-m", "venv", self.venv_path)
98-
url = plugin.get_remote_url() if not plugin.is_subpackage else self.pulpcore.get_remote_url()
99+
url = (
100+
plugin.get_remote_url()
101+
if not plugin.is_subpackage
102+
else self.pulpcore.get_remote_url()
103+
)
99104
install_cmd = ["pip", "install", f"git+{url}"]
100105

101106
if self.dry_run is True:

tests/test_openapi_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ def test_openapi_generation(tmp_path: Path, monkeypatch):
2222
assert {"core-api.json", "rpm-api.json", "file-api.json"} == set(output_ls)
2323

2424
for label, path in zip(output_labels, output_paths):
25-
openapi_data= json.loads(path.read_text())
25+
openapi_data = json.loads(path.read_text())
2626
assert label in openapi_data["info"]["x-pulp-app-versions"].keys()

0 commit comments

Comments
 (0)