Skip to content

Commit 556d490

Browse files
committed
Add repository specified to find_path
1 parent 6927eb6 commit 556d490

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/pulp_docs/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def find_path_callback(ctx: click.Context, param: click.Parameter, value: bool)
5959
expose_value=False,
6060
default="",
6161
callback=find_path_callback,
62-
help="A colon separated list of repository paths. Accepts glob patterns.",
62+
help="A colon separated list of lookup paths in the form: [repo1@]path1 [:[repo2@]path2 [...]].",
6363
)
6464

6565

src/pulp_docs/plugin.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,21 @@ class Component:
5353
def build(cls, find_path: list[str], component_opt: ComponentOption):
5454
body = dict(component_opt)
5555
repository_name = component_opt.path.split("/")[0]
56-
expanded_path = []
57-
for dir in find_path:
58-
expanded_path.extend(glob.glob(dir))
59-
for dir in expanded_path:
60-
dir = Path(dir)
61-
component_dir = dir.parent / component_opt.path
62-
found_dir = repository_name == dir.name and component_dir.exists()
63-
if found_dir:
56+
for dir_spec in find_path:
57+
repo_filter, _, basedir = dir_spec.rpartition("@")
58+
if repo_filter and repo_filter != repository_name:
59+
continue
60+
basedir = Path(basedir)
61+
component_dir = basedir / component_opt.path
62+
if component_dir.exists():
6463
version = "unknown"
6564
try:
6665
pyproject = component_dir / "pyproject.toml"
6766
version = tomllib.loads(pyproject.read_text())["project"]["version"]
6867
except Exception:
6968
pass
7069
body["version"] = version
71-
body["repository_dir"] = dir
70+
body["repository_dir"] = basedir / repository_name
7271
body["component_dir"] = component_dir
7372
return cls(**body)
7473
return None

0 commit comments

Comments
 (0)